upgrade flutter

This commit is contained in:
2025-02-11 22:11:45 +06:30
parent 4607c34879
commit 69361f8445
29 changed files with 498 additions and 713 deletions

View File

@@ -111,7 +111,7 @@ class _InitialLanguageSelectionPageState
child: CircleAvatar(
radius: 20,
backgroundImage: AssetImage(
"icons/flags/png/gb.png",
"icons/flags/png100px/gb.png",
package: 'country_icons',
),
),
@@ -120,7 +120,7 @@ class _InitialLanguageSelectionPageState
child: CircleAvatar(
radius: 20,
backgroundImage: AssetImage(
"icons/flags/png/mm.png",
"icons/flags/png100px/mm.png",
package: 'country_icons',
),
),
@@ -192,7 +192,8 @@ class _InitialLanguageSelectionPageState
bool isLogin = Provider.of<MainModel>(context, listen: false).isLogin();
String page = isLogin ? "/home" : "/welcome";
Navigator.of(context).pushReplacementNamed(page);
} catch (e) {} finally {
} catch (e) {
} finally {
setState(() {
_isLoading = false;
});

View File

@@ -66,13 +66,13 @@ class _WelcomePageState extends State<WelcomePage> {
ToggleButtons(
children: <Widget>[
Image.asset(
'icons/flags/png/us.png',
'icons/flags/png100px/us.png',
package: 'country_icons',
fit: BoxFit.fitWidth,
width: 25,
),
Image.asset(
'icons/flags/png/mm.png',
'icons/flags/png100px/mm.png',
package: 'country_icons',
fit: BoxFit.fitWidth,
width: 25,

View File

@@ -178,11 +178,13 @@ class _ProfileState extends State<Profile> {
iconData: Icons.email_outlined,
),
),
IconButton(icon: Icon(Icons.edit, color: Colors.grey), onPressed: () {
Navigator.of(context, rootNavigator: true).push(
IconButton(
icon: Icon(Icons.edit, color: Colors.grey),
onPressed: () {
Navigator.of(context, rootNavigator: true).push(
CupertinoPageRoute(
builder: (context) => AddRecoveryEmail(user: user)));
})
})
],
);
return LocalProgress(
@@ -275,13 +277,13 @@ class _ProfileState extends State<Profile> {
children: [
isEng
? Image.asset(
'icons/flags/png/us.png',
'icons/flags/png100px/us.png',
package: 'country_icons',
fit: BoxFit.fitWidth,
width: 25,
)
: Image.asset(
'icons/flags/png/mm.png',
'icons/flags/png100px/mm.png',
package: 'country_icons',
fit: BoxFit.fitWidth,
width: 25,

View File

@@ -4,73 +4,106 @@ import 'package:fcs/helpers/theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:intl/intl.dart';
import 'package:timeline_list/timeline.dart';
import 'package:timeline_list/timeline_model.dart';
import 'package:timeline_list/timeline_list.dart';
var dateFormatter = new DateFormat('dd MMM yyyy');
var dateFormatter = DateFormat('dd MMM yyyy');
class StatusTree extends StatelessWidget {
final List<ShipmentStatus>? shipmentHistory;
final String? currentStatus;
const StatusTree({Key? key, this.shipmentHistory, this.currentStatus})
: super(key: key);
const StatusTree({super.key, this.shipmentHistory, this.currentStatus});
@override
Widget build(BuildContext context) {
return ExpansionTile(
initiallyExpanded: true,
shape:
Border.symmetric(horizontal: BorderSide(color: Colors.grey.shade300)),
title: Text(
'Status',
style: TextStyle(color: primaryColor, fontWeight: FontWeight.bold),
),
bool isPacked = currentStatus != package_received_status &&
currentStatus != package_processed_status;
var receivedIcon = Container(
width: 25,
height: 25,
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.green),
child: Icon(MaterialCommunityIcons.inbox_arrow_down,
color: Colors.white, size: 18));
var processedIcon = Container(
width: 25,
height: 25,
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.green),
child: Icon(FontAwesome.dropbox, color: Colors.white, size: 18));
var packedIcon = Container(
width: 25,
height: 25,
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.green),
child: Icon(MaterialCommunityIcons.package,
color: Colors.white, size: 18));
var shippedIcon = Container(
width: 25,
height: 25,
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.green),
child: Icon(Ionicons.ios_airplane, color: Colors.white, size: 18));
var deliveredIcon = Container(
width: 25,
height: 25,
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.green),
child: Icon(MaterialCommunityIcons.truck_fast,
color: Colors.white, size: 18));
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Status',
style: TextStyle(color: primaryColor, fontWeight: FontWeight.bold),
),
Container(
padding: EdgeInsets.only(left: 20),
height: 400,
child: Timeline(children: _models(), position: TimelinePosition.Left),
child: Timeline.builder(
shrinkWrap: true,
context: context,
markerCount: shipmentHistory?.length ?? 0,
physics: NeverScrollableScrollPhysics(),
properties: TimelineProperties(
iconAlignment: MarkerIconAlignment.center,
iconSize: 25,
timelinePosition: TimelinePosition.start),
markerBuilder: (context, index) {
ShipmentStatus? e = shipmentHistory?[index];
return Marker(
child: SizedBox(
width: 250,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: e == null
? []
: <Widget>[
Text(e.status,
style: TextStyle(
color: e.done! ? primaryColor : Colors.grey,
fontSize: 16,
fontWeight: FontWeight.bold)),
e.done! || isPacked
? Text(dateFormatter.format(e.date))
: Container(),
e.staffName == null
? Container()
: Text(e.staffName!)
],
),
),
icon: e == null
? null
: e.status == "shipped"
? shippedIcon
: e.status == "delivered"
? deliveredIcon
: e.status == "packed"
? packedIcon
: e.status == "processed"
? processedIcon
: receivedIcon,
position: MarkerPosition.left,
);
},
),
)
],
);
}
List<TimelineModel> _models() {
if (shipmentHistory == null || currentStatus == null) return [];
bool isPacked = currentStatus != package_received_status &&
currentStatus != package_processed_status;
return shipmentHistory!
.map((e) => TimelineModel(
Padding(
padding: const EdgeInsets.all(18.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(e.status,
style: TextStyle(
color: e.done! ? primaryColor : Colors.grey,
fontSize: 16,
fontWeight: FontWeight.bold)),
e.done! || isPacked
? Text(dateFormatter.format(e.date))
: Container(),
e.staffName == null ? Container() : Text(e.staffName!)
],
),
),
iconBackground: e.done! ? primaryColor : Colors.grey,
icon: Icon(
e.status == "shipped"
? Ionicons.ios_airplane
: e.status == "delivered"
? MaterialCommunityIcons.truck_fast
: e.status == "packed"
? MaterialCommunityIcons.package
: e.status == "processed"
? FontAwesome.dropbox
: MaterialCommunityIcons.inbox_arrow_down,
color: Colors.white,
)))
.toList();
}
}