first commit
This commit is contained in:
64
lib/Screens/Home/components/bottom_nav.dart
Normal file
64
lib/Screens/Home/components/bottom_nav.dart
Normal file
@@ -0,0 +1,64 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mobile_pos/Screens/Settings/settings_screen.dart';
|
||||
import 'package:mobile_pos/constant.dart';
|
||||
import 'package:nb_utils/nb_utils.dart';
|
||||
|
||||
class BottomNav extends StatefulWidget {
|
||||
const BottomNav({
|
||||
Key? key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<BottomNav> createState() => _BottomNavState();
|
||||
}
|
||||
|
||||
class _BottomNavState extends State<BottomNav> {
|
||||
int _selectedIndex = 0;
|
||||
|
||||
void _onItemTapped(int index) {
|
||||
setState(() {
|
||||
_selectedIndex = index;
|
||||
switch (_selectedIndex) {
|
||||
case 0:
|
||||
Navigator.pushNamed(context, '/home');
|
||||
break;
|
||||
case 1:
|
||||
Navigator.pushNamed(context, '/order');
|
||||
break;
|
||||
case 2:
|
||||
Navigator.pushNamed(context, '/featuredProduct');
|
||||
break;
|
||||
case 3:
|
||||
const SettingScreen().launch(context);
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BottomNavigationBar(
|
||||
type: BottomNavigationBarType.fixed,
|
||||
elevation: 6.0,
|
||||
selectedItemColor: kMainColor,
|
||||
// ignore: prefer_const_literals_to_create_immutables
|
||||
items: [
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.home),
|
||||
label: 'Home',
|
||||
),
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.flare_sharp),
|
||||
label: 'Maan',
|
||||
),
|
||||
const BottomNavigationBarItem(
|
||||
icon: Icon(Icons.backpack),
|
||||
label: 'Package',
|
||||
),
|
||||
const BottomNavigationBarItem(icon: Icon(Icons.settings), label: 'Settings'),
|
||||
],
|
||||
currentIndex: _selectedIndex,
|
||||
onTap: _onItemTapped,
|
||||
);
|
||||
}
|
||||
}
|
||||
113
lib/Screens/Home/components/grid_items.dart
Normal file
113
lib/Screens/Home/components/grid_items.dart
Normal file
@@ -0,0 +1,113 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mobile_pos/generated/l10n.dart' as lang;
|
||||
|
||||
class GridItems {
|
||||
final String title, icon, route;
|
||||
|
||||
GridItems({required this.title, required this.icon, required this.route});
|
||||
}
|
||||
|
||||
List<GridItems> getFreeIcons({required BuildContext context, bool? brunchPermission, bool? hrmPermission}) {
|
||||
List<GridItems> freeIcons = [
|
||||
GridItems(
|
||||
title: lang.S.of(context).sale,
|
||||
icon: 'assets/sales.svg',
|
||||
route: 'Sales',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).posSale,
|
||||
icon: 'images/dash_pos.svg',
|
||||
route: 'Pos Sale',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).parties,
|
||||
icon: 'assets/parties.svg',
|
||||
route: 'Parties',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).purchase,
|
||||
icon: 'assets/purchase.svg',
|
||||
route: 'Purchase',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).product,
|
||||
icon: 'assets/products.svg',
|
||||
route: 'Products',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).dueList,
|
||||
icon: 'assets/duelist.svg',
|
||||
route: 'Due List',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).stockList,
|
||||
icon: 'assets/h_stock.svg',
|
||||
route: 'Stock',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).reports,
|
||||
icon: 'assets/reports.svg',
|
||||
route: 'Reports',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).saleList,
|
||||
icon: 'assets/salelist.svg',
|
||||
route: 'Sales List',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).purchaseList,
|
||||
icon: 'assets/purchaseLisst.svg',
|
||||
route: 'Purchase List',
|
||||
),
|
||||
GridItems(
|
||||
// TODO: Shakil change this to `Profit & Loss`
|
||||
title: lang.S.of(context).profitAndLoss,
|
||||
icon: 'assets/h_lossProfit.svg',
|
||||
route: 'Loss/Profit',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).ledger,
|
||||
icon: 'assets/ledger.svg',
|
||||
route: 'ledger',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).income,
|
||||
icon: 'assets/h_income.svg',
|
||||
route: 'Income',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).expense,
|
||||
icon: 'assets/expense.svg',
|
||||
route: 'Expense',
|
||||
),
|
||||
GridItems(
|
||||
title: lang.S.of(context).vatAndTax,
|
||||
icon: 'assets/tax.svg',
|
||||
route: 'tax',
|
||||
),
|
||||
// GridItems(
|
||||
// title: 'Warehouse',
|
||||
// icon: 'assets/tax.svg',
|
||||
// route: 'warehouse',
|
||||
// ),
|
||||
GridItems(
|
||||
title: lang.S.of(context).customPrint,
|
||||
icon: 'assets/printer.svg',
|
||||
route: 'customPrint',
|
||||
),
|
||||
if (brunchPermission == true)
|
||||
GridItems(
|
||||
title: lang.S.of(context).branch,
|
||||
icon: 'assets/branch.svg',
|
||||
route: 'branch',
|
||||
),
|
||||
if (hrmPermission ?? false)
|
||||
GridItems(
|
||||
title: lang.S.of(context).hrm,
|
||||
icon: 'assets/hrm/hrm.svg',
|
||||
route: 'hrm',
|
||||
),
|
||||
];
|
||||
|
||||
return freeIcons;
|
||||
}
|
||||
Reference in New Issue
Block a user