Improve navigation back

This commit is contained in:
fhkhd
2024-03-13 19:20:21 +03:30
parent 3db8ae3cfe
commit 92e02cc84e
10 changed files with 308 additions and 284 deletions
+40 -32
View File
@@ -77,7 +77,12 @@ class _CycleResultScreenState extends State<CycleResultScreen> {
),
appBar: AppBar(
titleSpacing: -10,
title: Text('Home', style: TextStyle(color: Colors.white,),),
title: Text(
'Home',
style: TextStyle(
color: Colors.white,
),
),
backgroundColor: Colors.black,
leading: IconButton(
icon: Icon(
@@ -85,7 +90,7 @@ class _CycleResultScreenState extends State<CycleResultScreen> {
color: Colors.white,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
onPressed: () => Navigator.of(context).pushNamed(Routes.homePage),
),
),
body: Consumer<ConnectivityProvider>(
@@ -198,37 +203,40 @@ class _CycleResultScreenState extends State<CycleResultScreen> {
color: Colors.black,
),
)
:
cycleResults.items?.length != 0 ?
ListView.builder(
controller: sc,
itemBuilder: (context, index) {
String labels = '';
for (var label in cycleResults
.items![index].label) {
labels += label;
labels += ' , ';
}
if (labels.length >= 3) {
labels = labels.substring(
0,
labels.length -
3); // remove extra ,
}
return CycleItemBox(
deviceBlockSize: _deviceBlockSize,
item: cycleResults.items?[index],
labels: labels,
: cycleResults.items?.length != 0
? ListView.builder(
controller: sc,
itemBuilder: (context, index) {
String labels = '';
for (var label in cycleResults
.items![index].label) {
labels += label;
labels += ' , ';
}
if (labels.length >= 3) {
labels = labels.substring(
0,
labels.length -
3); // remove extra ,
}
return CycleItemBox(
deviceBlockSize:
_deviceBlockSize,
item:
cycleResults.items?[index],
labels: labels,
);
},
itemCount:
cycleResults.items?.length,
shrinkWrap: true,
)
: Container(
child: Center(
child: Text(
"There is no item to show."),
),
);
},
itemCount: cycleResults.items?.length,
shrinkWrap: true,
) :
Container(
child: Center(
child: Text("There is no item to show."),
),
);
},
),
),