Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:badges/badges.dart';
- import 'package:bubu_market/constants/utils.dart';
- import 'package:bubu_market/router/route_generator.dart';
- import 'package:bubu_market/screens/home/favourite_screen.dart';
- import 'package:bubu_market/screens/home/person_screen.dart';
- import 'package:bubu_market/widgets/home_widgets/search_box.dart';
- import 'package:flutter/material.dart';
- import 'package:go_router/go_router.dart';
- import 'package:google_fonts/google_fonts.dart';
- import 'category_deals.dart';
- import 'home_body.dart';
- class HomeScreen extends StatefulWidget {
- final Widget child;
- const HomeScreen({Key? key, required this.child}) : super(key: key);
- @override
- State<HomeScreen> createState() => _HomeScreenState();
- }
- class _HomeScreenState extends State<HomeScreen> {
- late PageController pageController;
- int _currentIndex = 0;
- final List<Widget> _children = [
- const Home(),
- const FavouriteScreen(),
- const PersonScreen(),
- ];
- void onTapTapped(int index) {
- setState(() {
- _currentIndex = index;
- });
- }
- void navigateCategoryPage(BuildContext context, String category) {
- context.goNamed(
- "Catergories",
- params: {"category": "category"},
- );
- }
- @override
- Widget build(BuildContext context) {
- SizeConfig().init(context);
- return GestureDetector(
- onTap: () => FocusManager.instance.primaryFocus?.unfocus(),
- child: Scaffold(
- appBar: AppBar(
- centerTitle: true,
- iconTheme: const IconThemeData(color: Colors.black),
- title: Image.asset(
- 'assets/images/logo-on-white.8352d7ab.png',
- width: 150,
- height: 150,
- ),
- elevation: 0,
- actions: [
- Padding(
- padding: const EdgeInsets.only(right: 10),
- child: Badge(
- padding: const EdgeInsets.all(8),
- elevation: 0,
- badgeContent: Text(
- "4",
- style: GoogleFonts.nunito(
- fontSize: 17,
- decorationStyle: TextDecorationStyle.wavy,
- fontWeight: FontWeight.bold,
- ),
- ),
- badgeColor: Colors.transparent,
- child: const Icon(
- Icons.shopping_cart_checkout_outlined,
- size: 30,
- ),
- ),
- ),
- ],
- flexibleSpace: Container(
- decoration: const BoxDecoration(
- color: Color(0xffEEEEEE),
- ),
- ),
- bottom: const PreferredSize(
- preferredSize: Size.fromHeight(42),
- child: SearchBox(),
- )),
- drawer: const Drawer(),
- bottomNavigationBar: BottomNavigationBar(
- iconSize: 30,
- onTap: onTapTapped,
- currentIndex: _currentIndex,
- elevation: 10,
- selectedItemColor: Colors.black,
- unselectedItemColor: Colors.black,
- backgroundColor: const Color(0xffF4DC51),
- showSelectedLabels: false,
- showUnselectedLabels: false,
- items: [
- BottomNavigationBarItem(
- icon: Icon(
- _currentIndex == 0 ? Icons.home : Icons.home_outlined,
- color: Colors.black,
- ),
- label: 'Home'),
- BottomNavigationBarItem(
- icon: Icon(
- _currentIndex == 1 ? Icons.favorite : Icons.favorite_border,
- color: Colors.black,
- ),
- label: 'Favourite'),
- BottomNavigationBarItem(
- icon: Icon(
- _currentIndex == 2 ? Icons.person : Icons.person_outline,
- color: Colors.black,
- ),
- label: 'Contact'),
- // BottomNavigationBarItem(
- // icon: Icon(
- // _currentIndex == 3 ? Icons.notifications : Icons.notifications_outlined,
- // color: Colors.black,
- // ),
- // label: 'Notifications'),
- ]),
- body: widget.child,
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement