Flutter Widget Listesi&BottomNavigationBar

Uygulama Oluşturun.

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(),
);
}
}
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; });
},
),
);
}
}
List<Widget> _icerikler;
@override void initState() { 
super.initState();
_icerikler = [
Text("BURADA ANASAYFA İÇERİKLERİ YER ALIR"),
Text("BURADA SEPET İÇERİKLERİ YER ALIR"),
];
}
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;
});
},
),
bottomNavigationBar: BottomNavigationBar()
selectedItemColor: Colors.red[400],
unselectedItemColor: Colors.grey[600],
items: [ 
BottomNavigationBarItem( // ignore: deprecated_member_use icon: Icon(Icons.home),
title: Text(“ANASAYFA”),
),
onTap: (int tiklananButonPozisyonNo) { 
setState(() {
_aktifIcerikNo = tiklananButonPozisyonNo;
});
int _aktifIcerikNo = 0;
body: _icerikler[_aktifIcerikNo],

EKRAN GÖRÜNTÜLERİ

Bilgisayar Programıcısı-AÖF Yönetim Bilişim Sistemleri/DART&FLUTTER

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
AbdullahTaş

AbdullahTaş

Bilgisayar Programıcısı-AÖF Yönetim Bilişim Sistemleri/DART&FLUTTER

More from Medium

Flutter CLI Cheat Sheet

Flutter — Introduction

Flutter Roadmap & Resource Guide — 2022

Flutter MVP architecture with Riverpod and HookConsumerWidget