Files
fcs/lib/pages/carton_search/carton_list_row.dart
phyothandar 5e672937b5 null safety
2021-09-10 12:00:08 +06:30

106 lines
3.5 KiB
Dart

import 'package:fcs/domain/entities/carton.dart';
import 'package:fcs/helpers/theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
import 'carton_search.dart';
class CartonListRow extends StatefulWidget {
final CallbackCartonSelect? callbackCartonSelect;
final Carton? carton;
// const CartonListRow({this.carton, this.callbackCartonSelect});
CartonListRow(
{Key? key, this.carton, this.callbackCartonSelect})
: super(key: key);
@override
_CartonListRowState createState() => _CartonListRowState();
}
class _CartonListRowState extends State<CartonListRow> {
final double dotSize = 15.0;
Carton? _carton;
@override
void initState() {
super.initState();
this._carton = widget.carton;
}
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(color: Colors.grey.shade300),
),
),
child: InkWell(
onTap: () {
Navigator.pop(context);
if (widget.callbackCartonSelect != null)
widget.callbackCartonSelect!(widget.carton!);
},
child: Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 13.0),
child: new Row(
children: <Widget>[
new Padding(
padding: new EdgeInsets.symmetric(
horizontal: 25.0 - dotSize / 2),
child: Icon(
MaterialCommunityIcons.package,
color: primaryColor,
size: 30,
),
),
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
_carton!.cartonNumber,
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.only(left: 10.0, top: 10),
child: new Text(
_carton!.userName,
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
)
],
),
),
Padding(
padding: const EdgeInsets.only(
left: 8.0, bottom: 5, right: 10),
child: Row(
children: <Widget>[
new Text(
"${_carton!.cartonWeight.toStringAsFixed(2)} lb",
style: new TextStyle(
fontSize: 15.0, color: Colors.grey),
),
],
),
),
],
),
),
),
],
),
),
);
}
}