Arrange the tiles of home and dashboard

This commit is contained in:
hanie.khodkari
2025-03-16 18:08:13 +03:30
parent 7dbe9e295e
commit 46dbd464ba
2 changed files with 143 additions and 65 deletions
+48 -49
View File
@@ -146,22 +146,41 @@ class HomePage extends StatelessWidget {
), ),
), ),
), ),
Divider(
height: 2,
),
SelectionItem( SelectionItem(
firstLine: 'LABELS', firstLine: 'TEST TO VERIFY',
secondLine: 'List, Details & Add a one', secondLine: 'Verify and reject Test Results',
firstLineColor: kLightBlue, firstLineColor: Colors.black,
secondLineColor: kLightBlueSub, secondLineColor: Colors.grey,
backgroundColor: kLightBlueBackground, backgroundColor: kLightGreyBackground,
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) { builder: (context) {
return Consumer<Auth>( return Consumer<Auth>(
builder: (ctx, auth, _) { builder: (ctx, auth, _) {
return LabelResultScreen(); return TestVerifyScreen();
},
);
},
),
),
),
Divider(
height: 2,
),
SelectionItem(
firstLine: 'ITEMS',
secondLine: 'List, Details & Add a one',
firstLineColor: kBlue,
secondLineColor: kBlueSub,
backgroundColor: kBlueBackground,
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return ItemResultScreen();
}, },
); );
}, },
@@ -169,18 +188,18 @@ class HomePage extends StatelessWidget {
), ),
), ),
SelectionItem( SelectionItem(
firstLine: 'CYCLES', firstLine: 'MY ITEMS',
secondLine: 'List, Details & Add a one', secondLine: 'The Items that i possess',
firstLineColor: kPink, firstLineColor: kDarkBlue,
secondLineColor: kPinkSub, secondLineColor: kDarkBlueSub,
backgroundColor: kPinkBackground, backgroundColor: kDarkBlueBackground,
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) { builder: (context) {
return Consumer<Auth>( return Consumer<Auth>(
builder: (ctx, auth, _) { builder: (ctx, auth, _) {
return CycleResultScreen(); return MyItemsResultScreen();
}, },
); );
}, },
@@ -232,18 +251,18 @@ class HomePage extends StatelessWidget {
height: 2, height: 2,
), ),
SelectionItem( SelectionItem(
firstLine: 'ITEMS', firstLine: 'LABELS',
secondLine: 'List, Details & Add a one', secondLine: 'List, Details & Add a one',
firstLineColor: kBlue, firstLineColor: kLightBlue,
secondLineColor: kBlueSub, secondLineColor: kLightBlueSub,
backgroundColor: kBlueBackground, backgroundColor: kLightBlueBackground,
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) { builder: (context) {
return Consumer<Auth>( return Consumer<Auth>(
builder: (ctx, auth, _) { builder: (ctx, auth, _) {
return ItemResultScreen(); return LabelResultScreen();
}, },
); );
}, },
@@ -251,18 +270,18 @@ class HomePage extends StatelessWidget {
), ),
), ),
SelectionItem( SelectionItem(
firstLine: 'MY ITEMS', firstLine: 'CYCLES',
secondLine: 'The Items that i possess', secondLine: 'List, Details & Add a one',
firstLineColor: kDarkBlue, firstLineColor: kPink,
secondLineColor: kDarkBlueSub, secondLineColor: kPinkSub,
backgroundColor: kDarkBlueBackground, backgroundColor: kPinkBackground,
onTap: () => Navigator.push( onTap: () => Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) { builder: (context) {
return Consumer<Auth>( return Consumer<Auth>(
builder: (ctx, auth, _) { builder: (ctx, auth, _) {
return MyItemsResultScreen(); return CycleResultScreen();
}, },
); );
}, },
@@ -270,25 +289,6 @@ class HomePage extends StatelessWidget {
), ),
), ),
Divider(height: 2), Divider(height: 2),
SelectionItem(
firstLine: 'TEST TO VERIFY',
secondLine: 'Verify and reject Test Results',
firstLineColor: Colors.black,
secondLineColor: Colors.grey,
backgroundColor: kLightGreyBackground,
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return Consumer<Auth>(
builder: (ctx, auth, _) {
return TestVerifyScreen();
},
);
},
),
),
),
BarcodeSelectionItem(), BarcodeSelectionItem(),
], ],
), ),
@@ -331,14 +331,13 @@ class SelectionItem extends StatelessWidget {
final Color? backgroundColor; final Color? backgroundColor;
final VoidCallback? onTap; final VoidCallback? onTap;
SelectionItem({ SelectionItem(
this.firstLine, {this.firstLine,
this.secondLine, this.secondLine,
this.onTap, this.onTap,
this.firstLineColor, this.firstLineColor,
this.secondLineColor, this.secondLineColor,
this.backgroundColor this.backgroundColor});
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
+91 -12
View File
@@ -4,8 +4,10 @@ import 'package:cssd/providers/auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../config/routes.dart'; import '../../config/routes.dart';
import '../../pages/TestPages/test_filter_screen.dart';
class AppDrawer extends StatefulWidget { class AppDrawer extends StatefulWidget {
@override @override
@@ -24,6 +26,10 @@ class _AppDrawerState extends State<AppDrawer> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return SafeArea( return SafeArea(
child: SizedBox( child: SizedBox(
width: 250, width: 250,
@@ -142,7 +148,7 @@ class _AppDrawerState extends State<AppDrawer> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context).pushNamed(Routes.labelResultScreen); Navigator.of(context).pushNamed(Routes.itemResultScreen);
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15), padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
@@ -153,14 +159,14 @@ class _AppDrawerState extends State<AppDrawer> {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Icon( Icon(
FontAwesomeIcons.tag, Icons.book,
color: Colors.white, color: Colors.white,
), ),
SizedBox( SizedBox(
width: 10, width: 10,
), ),
Text( Text(
'Labels', 'Items',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
), ),
@@ -171,7 +177,7 @@ class _AppDrawerState extends State<AppDrawer> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context).pushNamed(Routes.cycleResultScreen); Navigator.of(context).pushNamed(Routes.myItemsResultScreen);
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15), padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
@@ -182,14 +188,14 @@ class _AppDrawerState extends State<AppDrawer> {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Icon( Icon(
Icons.refresh, Icons.my_library_books,
color: Colors.white, color: Colors.white,
), ),
SizedBox( SizedBox(
width: 10, width: 10,
), ),
Text( Text(
'Cycles', 'My Items',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
), ),
@@ -259,7 +265,7 @@ class _AppDrawerState extends State<AppDrawer> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context).pushNamed(Routes.itemResultScreen); Navigator.of(context).pushNamed(Routes.labelResultScreen);
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15), padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
@@ -270,14 +276,14 @@ class _AppDrawerState extends State<AppDrawer> {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Icon( Icon(
Icons.book, FontAwesomeIcons.tag,
color: Colors.white, color: Colors.white,
), ),
SizedBox( SizedBox(
width: 10, width: 10,
), ),
Text( Text(
'Items', 'Labels',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
), ),
@@ -288,7 +294,7 @@ class _AppDrawerState extends State<AppDrawer> {
), ),
InkWell( InkWell(
onTap: () { onTap: () {
Navigator.of(context).pushNamed(Routes.myItemsResultScreen); Navigator.of(context).pushNamed(Routes.cycleResultScreen);
}, },
child: Container( child: Container(
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15), padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
@@ -299,14 +305,87 @@ class _AppDrawerState extends State<AppDrawer> {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Icon( Icon(
Icons.my_library_books, Icons.refresh,
color: Colors.white, color: Colors.white,
), ),
SizedBox( SizedBox(
width: 10, width: 10,
), ),
Text( Text(
'My Items', 'Cycles',
style: TextStyle(
color: Colors.white,
),
)
],
),
),
),
InkWell(
onTap: () => scan().then(
(String result) {
if (result == 'cancel') {
print('cancel');
} else if (result == 'error') {
print('error');
} else if (result == 'access') {
print('access');
} else {
print(result);
showDialog(
context: context,
builder: (_) => AlertDialog(
title: Text(
'نتیجه ی اسکن',
textDirection: TextDirection.rtl,
textAlign: TextAlign.right,
style: TextStyle(
fontSize: 2.75 * _deviceBlockSize,
),
),
content: Text(
result,
textDirection: TextDirection.rtl,
style: TextStyle(
fontSize: 4 * _deviceBlockSize,
),
),
actions: <Widget>[
TextButton(
onPressed: () async {
await launch(result);
Navigator.of(context).pop();
},
child: Text(
'بازکردن در مرورگر',
style: TextStyle(
fontFamily: 'montserrat',
),
),
),
],
),
);
}
},
),
child: Container(
padding: EdgeInsets.symmetric(vertical: 5, horizontal: 15),
margin: EdgeInsets.only(top: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(5),
),
child: Row(
children: <Widget>[
Icon(
Icons.qr_code_scanner,
color: Colors.white,
),
SizedBox(
width: 10,
),
Text(
'Scanner',
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
), ),