Open berkeresvan opened 6 months ago
import 'package:bottomnavigationbar/sayfabir.dart'; import 'package:bottomnavigationbar/sayfaiki.dart'; import 'package:bottomnavigationbar/sayfauc.dart'; import 'package:flutter/material.dart';
void main() { runApp(const MyApp()); }
class MyApp extends StatelessWidget { const MyApp({super.key});
@override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: const MyHomePage(title: 'Flutter Demo Home Page'), ); } }
class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title});
final String title;
@override State createState() => _MyHomePageState(); }
class _MyHomePageState extends State { var sayfalistesi = [sayfabir(), sayfaiki(), sayfauc()]; int secilenIndex = 0; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( backgroundColor: Colors.deepPurple, title: Text(widget.title), ), body: sayfalistesi[secilenIndex], bottomNavigationBar: BottomNavigationBar( items: [ BottomNavigationBarItem(icon: Icon(Icons.looks_one), label: "Bir"), BottomNavigationBarItem(icon: Icon(Icons.looks_two), label: "İki"), BottomNavigationBarItem(icon: Icon(Icons.looks_3), label: "Uç"), ], backgroundColor: Colors.deepPurple, selectedItemColor: Colors.orange, unselectedItemColor: Colors.white, currentIndex: secilenIndex, onTap: (indeks) { setState(() { secilenIndex = indeks; }); }, ), ); } }
import 'package:flutter/material.dart';
class sayfabir extends StatefulWidget { const sayfabir({super.key});
@override State createState() => _sayfabirState(); }
class _sayfabirState extends State { @override Widget build(BuildContext context) { return Center( child: Text( "Sayfa bir", style: TextStyle(color: Colors.black54, fontSize: 30), ), ); } }
import 'package:bottomnavigationbar/sayfabir.dart'; import 'package:bottomnavigationbar/sayfaiki.dart'; import 'package:bottomnavigationbar/sayfauc.dart'; import 'package:flutter/material.dart';
void main() { runApp(const MyApp()); }
class MyApp extends StatelessWidget { const MyApp({super.key});
@override Widget build(BuildContext context) { return MaterialApp( title: 'Flutter Demo', theme: ThemeData( colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), useMaterial3: true, ), home: const MyHomePage(title: 'Flutter Demo Home Page'), ); } }
class MyHomePage extends StatefulWidget { const MyHomePage({super.key, required this.title});
final String title;
@override State createState() => _MyHomePageState();
}
class _MyHomePageState extends State {
var sayfalistesi = [sayfabir(), sayfaiki(), sayfauc()];
int secilenIndex = 0;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.deepPurple,
title: Text(widget.title),
),
body: sayfalistesi[secilenIndex],
bottomNavigationBar: BottomNavigationBar(
items: [
BottomNavigationBarItem(icon: Icon(Icons.looks_one), label: "Bir"),
BottomNavigationBarItem(icon: Icon(Icons.looks_two), label: "İki"),
BottomNavigationBarItem(icon: Icon(Icons.looks_3), label: "Uç"),
],
backgroundColor: Colors.deepPurple,
selectedItemColor: Colors.orange,
unselectedItemColor: Colors.white,
currentIndex: secilenIndex,
onTap: (indeks) {
setState(() {
secilenIndex = indeks;
});
},
),
);
}
}