update carton info

This commit is contained in:
tzw
2024-02-09 13:49:18 +06:30
parent e485e5792e
commit 2d912a20aa
16 changed files with 300 additions and 914 deletions

View File

@@ -0,0 +1,103 @@
import 'package:fcs/domain/entities/carton.dart';
import 'package:fcs/helpers/theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:intl/intl.dart';
import '../carton_info.dart';
class CartonListRow extends StatelessWidget {
final Carton box;
CartonListRow({Key? key, required this.box}) : super(key: key);
final double dotSize = 15.0;
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () {
Navigator.push(
context,
CupertinoPageRoute(builder: (context) => CartonInfo(carton: box)),
);
},
child: Container(
padding: EdgeInsets.only(left: 15, right: 15),
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: new Row(
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 5),
child: Icon(
MaterialCommunityIcons.package,
color: primaryColor,
size: 30,
),
),
new Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 18.0),
child: Row(
children: [
new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
new Text(
box.cartonNumber ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
Padding(
padding: const EdgeInsets.only(top: 5),
child: new Text(
box.userName ?? "",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
),
],
),
const SizedBox(width: 15),
IconButton(
onPressed: () {}, icon: Icon(AntDesign.qrcode,color: Colors.black))
],
),
),
),
],
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(box.status ?? "",
style: TextStyle(
color: primaryColor,
fontSize: 15,
fontWeight: FontWeight.bold)),
Padding(
padding: const EdgeInsets.only(top: 5),
child: Row(
children: <Widget>[
new Text(
"${box.cartonWeight.toStringAsFixed(2)} lb",
style:
new TextStyle(fontSize: 15.0, color: Colors.grey),
),
],
),
),
],
)
],
),
),
);
}
}

View File

@@ -0,0 +1,57 @@
import 'package:fcs/domain/entities/carton.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'package:intl/intl.dart';
class CartonRow extends StatelessWidget {
final Carton box;
CartonRow({Key? key, required this.box}) : super(key: key);
final double dotSize = 15.0;
final DateFormat dateFormat = new DateFormat("dd MMM yyyy");
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
border: Border(bottom: BorderSide(color: Colors.grey.shade300)),
),
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 5.0),
child: new Row(
children: <Widget>[
new Text(box.cartonNumber ?? "",
style:
new TextStyle(fontSize: 15.0, color: Colors.black)),
const SizedBox(width: 15),
IconButton(onPressed: () {}, icon: Icon(AntDesign.qrcode)),
],
),
),
),
Column(
children: <Widget>[
box.cartonWeight == 0
? Container()
: Padding(
padding: const EdgeInsets.only(left: 8.0, bottom: 5),
child: Row(
children: <Widget>[
new Text(
"${box.cartonWeight.toStringAsFixed(2)} lb",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
],
),
),
],
),
],
),
);
}
}

View File

@@ -0,0 +1,103 @@
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:flutter/material.dart';
import '../../../../helpers/theme.dart';
import '../../../domain/entities/user.dart';
typedef OnAction = Future<void> Function();
class UserSearchResult extends StatelessWidget {
final bool isLoadingMore;
final OnAction onLoadMore;
final OnAction onRefresh;
final Function(User)? onTap;
final ScrollController controller;
final User? selectedUser;
final List<User> searchResults;
final String? noDataLabelKey;
final bool isLoading;
const UserSearchResult(
{super.key,
required this.isLoadingMore,
required this.onLoadMore,
required this.onRefresh,
this.onTap,
required this.controller,
this.selectedUser,
this.searchResults = const [],
this.noDataLabelKey,
this.isLoading = false});
bool _scrollNotification(ScrollNotification scrollInfo) {
if (!isLoadingMore &&
scrollInfo.metrics.pixels == scrollInfo.metrics.maxScrollExtent) {
onLoadMore();
}
return true;
}
@override
Widget build(BuildContext context) {
return searchResults.isEmpty && !isLoading
? noDataLabelKey== null? const SizedBox(): Center(
child: LocalText(context, noDataLabelKey!,
color: Colors.black, fontSize: 15))
: Column(children: [
Expanded(
child: NotificationListener<ScrollNotification>(
onNotification: _scrollNotification,
child: RefreshIndicator(
color: primaryColor,
onRefresh: () => onRefresh(),
child: ListView.builder(
controller: controller,
shrinkWrap: true,
physics: const AlwaysScrollableScrollPhysics(),
itemBuilder: (context, index) {
User user = searchResults[index];
return ListTile(
onTap: () {
if (onTap != null) {
onTap!(user);
}
},
title: Row(
children: [
Text(user.name ?? "",
style: const TextStyle(
fontSize: 15, color: Colors.black)),
user.fcsID == null
? const SizedBox()
: Padding(
padding: const EdgeInsets.only(left: 8),
child: Text(user.fcsID!,
style: const TextStyle(
fontSize: 15, color: labelColor)),
),
const SizedBox(
width: 20,
),
selectedUser?.id == user.id
? const Icon(
Icons.check,
color: Colors.grey,
)
: const SizedBox()
],
),
);
},
itemCount: searchResults.length)),
)),
Container(
height: isLoadingMore ? 50.0 : 0,
color: Colors.transparent,
child: const Center(
child: CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(primaryColor)),
)),
]);
}
}