fix profile
This commit is contained in:
66
lib/pages/widgets/status_tree.dart
Normal file
66
lib/pages/widgets/status_tree.dart
Normal file
@@ -0,0 +1,66 @@
|
||||
import 'package:fcs/domain/constants.dart';
|
||||
import 'package:fcs/domain/entities/package.dart';
|
||||
import 'package:fcs/domain/vo/shipment_status.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:timeline_list/timeline.dart';
|
||||
import 'package:timeline_list/timeline_model.dart';
|
||||
|
||||
var dateFormatter = new 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);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
height: 400,
|
||||
child: Timeline(children: _models(), position: TimelinePosition.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(),
|
||||
],
|
||||
),
|
||||
),
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user