Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Projem',
theme: ThemeData(
primarySwatch: Colors.green,
),
home: AnaSayfa(),
);
}
}
class AnaSayfa extends StatefulWidget {
@override
_AnaSayfaState createState() => _AnaSayfaState();
}
class _AnaSayfaState extends State<AnaSayfa> {
int _aktifIcerikNo = 0;
List<Widget> _icerikler;
@override
void initState() {
super.initState();
_icerikler = [
Text("BURADA ANASAYFA İÇERİKLERİ YER ALIR"),
Text("BURADA SEPET İÇERİKLERİ YER ALIR"),
];
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
iconTheme: IconThemeData(color: Colors.red[400]),
elevation: 0.0,
backgroundColor: Colors.white,
centerTitle: true,
title: Text(
"widget Listesi ve BottomNavigationBar",
style: TextStyle(
fontSize: 20.0, fontWeight: FontWeight.bold, color: Colors.grey),
),
),
body: _icerikler[_aktifIcerikNo],
bottomNavigationBar: BottomNavigationBar(
currentIndex: _aktifIcerikNo,
selectedItemColor: Colors.red[400],
unselectedItemColor: Colors.grey[600],
items: [
BottomNavigationBarItem(
// ignore: deprecated_member_use
icon: Icon(Icons.home), title: Text("ANASAYFA")),
BottomNavigationBarItem(
// ignore: deprecated_member_use
icon: Icon(Icons.shopping_cart), title: Text("SEPET"))
],
onTap: (int tiklananButonPozisyonNo) {
setState(() {
_aktifIcerikNo = tiklananButonPozisyonNo;
});
},
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment