Mobile_POS_App/lib/main.dart
Mengsreang-Channel 58e36e659c first commit
2021-02-01 17:07:44 +07:00

190 lines
4.8 KiB
Dart

import 'package:Mobile_POS/screens/add_to_cart_screen.dart';
import 'package:Mobile_POS/screens/dashboard_screen.dart';
import './screens/login_screen.dart';
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.deepOrange,
scaffoldBackgroundColor: Colors.white,
),
debugShowCheckedModeBanner: false,
// home: MyHomePage(),
home: LoginScreen(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> with SingleTickerProviderStateMixin {
int _currentIndex = 0;
TabController controller;
@override
void initState(){
super.initState();
controller = TabController(length: 2, vsync: this);
}
@override
void dispose(){
controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
'Simon\'s BBQ Team',
),
bottom: TabBar(
controller: controller,
tabs: [
Tab(
icon: Icon(Icons.all_inbox),
child: Text('Item'),
),
Tab(
icon: Icon(Icons.add_shopping_cart),
child: Text('Add to Cart'),
),
],
),
),
endDrawer: Drawer(
child: Column(
children: [
Container(
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 20),
color: Colors.deepOrange,
child: Column(
children: [
Icon(
Icons.food_bank_outlined,
size: 200,
color: Colors.white,
),
Text(
'Simon\'s BBQ Team',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
color: Colors.white,
),
),
],
),
),
ListTile(
onTap: (){},
leading: Icon(Icons.person_rounded),
title: Text(
'Profile',
style: TextStyle(
fontSize: 18,
),
),
),
ListTile(
onTap: (){},
leading: Icon(Icons.account_box_outlined),
title: Text(
'About Us',
style: TextStyle(
fontSize: 18,
),
),
),
ListTile(
onTap: (){},
leading: Icon(Icons.contact_page),
title: Text(
'Contact Us',
style: TextStyle(
fontSize: 18,
),
),
),
ListTile(
onTap: (){},
leading: Icon(Icons.help_outline_rounded),
title: Text(
'Help',
style: TextStyle(
fontSize: 18,
),
),
),
ListTile(
onTap: (){},
leading: Icon(Icons.exit_to_app),
title: Text(
'Exit',
style: TextStyle(
fontSize: 18,
),
),
),
],
),
),
body: TabBarView(
controller: controller,
children: [
DashboardScreen(),
AddToCartScreen(),
],
),
bottomNavigationBar: BottomNavigationBar(
currentIndex: _currentIndex,
type: BottomNavigationBarType.fixed,
backgroundColor: Colors.blueGrey[100],
items: [
BottomNavigationBarItem(
icon: Icon(Icons.all_inbox_outlined),
title: Text('All Items'),
),
BottomNavigationBarItem(
icon: Icon(Icons.food_bank_outlined),
title: Text('Food'),
),
BottomNavigationBarItem(
icon: Icon(Icons.hourglass_bottom),
title: Text('Alcohol'),
),
BottomNavigationBarItem(
icon: Icon(Icons.local_drink),
title: Text('Cold Drinks'),
),
BottomNavigationBarItem(
icon: Icon(Icons.no_drinks),
title: Text('Hot Drinks'),
),
],
onTap: (index){
setState(() {
_currentIndex = index;
});
},
),
);
}
}