feat: splash page done
This commit is contained in:
@@ -1,27 +0,0 @@
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import '../../../../food_delivery_client.dart';
|
||||
|
||||
mixin MainPageMixin {
|
||||
final List<Widget> pages = [
|
||||
HomePage(),
|
||||
BrowsePage(),
|
||||
BasketPage(),
|
||||
AccountPage(),
|
||||
];
|
||||
|
||||
final List<Widget> defaultIcons = [
|
||||
SvgPicture.asset(AppIcons.icHome),
|
||||
SvgPicture.asset(AppIcons.icBrowse),
|
||||
SvgPicture.asset(AppIcons.icBasket),
|
||||
SvgPicture.asset(AppIcons.icAccount),
|
||||
];
|
||||
|
||||
final List<Widget> activeIcons = [
|
||||
SvgPicture.asset(AppIcons.icHomeActive),
|
||||
SvgPicture.asset(AppIcons.icBrowseActive),
|
||||
SvgPicture.asset(AppIcons.icBasketActive),
|
||||
SvgPicture.asset(AppIcons.icAccountActive),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
import '../../../../../food_delivery_client.dart';
|
||||
|
||||
class MainPage extends StatelessWidget with MainPageMixin {
|
||||
MainPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<String> labels = [
|
||||
context.loc.home,
|
||||
context.loc.browse,
|
||||
context.loc.baskets,
|
||||
context.loc.account,
|
||||
];
|
||||
return BlocProvider(
|
||||
create: (context) => sl<MainBloc>(),
|
||||
child: BlocBuilder<MainBloc, MainState>(
|
||||
builder: (context, state) {
|
||||
return Scaffold(
|
||||
body: IndexedStack(
|
||||
index: state.currentIndex,
|
||||
sizing: StackFit.expand,
|
||||
alignment: AlignmentGeometry.center,
|
||||
children: pages,
|
||||
),
|
||||
bottomNavigationBar: BottomNavigationBar(
|
||||
onTap: (value) {
|
||||
context.read<MainBloc>().add(MainEvent.loaded(value));
|
||||
},
|
||||
currentIndex: state.currentIndex,
|
||||
items: List.generate(
|
||||
defaultIcons.length,
|
||||
(index) => BottomNavigationBarItem(
|
||||
icon: defaultIcons[index].paddingOnly(bottom: 4.85),
|
||||
activeIcon: activeIcons[index].paddingOnly(bottom: 4.85),
|
||||
label: labels[index],
|
||||
tooltip: labels[index],
|
||||
backgroundColor: AppColors.cFFFFFF,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user