/
main_screen.dart
59 lines (53 loc) · 1.65 KB
/
main_screen.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// ignore_for_file: prefer_typing_uninitialized_variables
import 'package:fashion_app/constant/asset_constants.dart';
import 'package:fashion_app/constant/color_constant.dart';
import 'package:fashion_app/page/home_screen.dart';
import 'package:fashion_app/page/profile_page.dart';
import 'package:fashion_app/product/product_appbar.dart';
import 'package:fashion_app/theme/theme.dart';
import 'package:fashion_app/widget/bottom_nav_bar.dart';
import 'package:flutter/material.dart';
class MainScreen extends StatefulWidget {
const MainScreen({Key? key}) : super(key: key);
@override
State<MainScreen> createState() => _MainScreenState();
}
class _MainScreenState extends State<MainScreen> {
bool _darkTheme = false;
int _currentIndex = 0;
final pageList = [
HomeScreen(),
ProfilePage(
itemList: AssetConstant.itemList,
),
];
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme:_darkTheme ? ProductTheme.darkTheme : ProductTheme.lightTheme,
home: Scaffold(
bottomNavigationBar: ProductNavBar(
currentIndex: _currentIndex,
onItemSelected: (index) {
setState(() {
_currentIndex = index;
});
},
fixedColor: _darkTheme
? ProductColors.darkThemeIconColor
: ProductColors.lightThemeIconColor,
),
appBar: ProductAppBar(
func: () {
setState(() {
_darkTheme = !_darkTheme;
});
},
isDarkTheme: _darkTheme,
),
body: pageList[_currentIndex],
),
);
}
}