update package selection and cartion selection
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:fcs/domain/entities/fcs_shipment.dart';
|
||||
import 'package:fcs/helpers/theme.dart';
|
||||
import 'package:fcs/pages/carton/mix_carton/carton_selection_result.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../domain/entities/carton.dart';
|
||||
@@ -39,17 +40,26 @@ class _CartonSelectionWidgetState extends State<CartonSelectionWidget> {
|
||||
String _query = "";
|
||||
bool _isLoadMore = false;
|
||||
final _scrollController = ScrollController();
|
||||
bool _down = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_init();
|
||||
super.initState();
|
||||
_scrollController.addListener(() {
|
||||
setState(() {
|
||||
_down = _scrollController.position.userScrollDirection ==
|
||||
ScrollDirection.forward;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
_init() {
|
||||
var model = context.read<CartonSelectionModel>();
|
||||
model.addDefaultCartons(widget.shipment.id!);
|
||||
|
||||
model.addSelectedCarton(widget.cartons);
|
||||
|
||||
_controller.text = model.query;
|
||||
_query = model.query;
|
||||
if (mounted) {
|
||||
@@ -167,6 +177,26 @@ class _CartonSelectionWidgetState extends State<CartonSelectionWidget> {
|
||||
),
|
||||
);
|
||||
|
||||
final selectedCartonBox = Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: EdgeInsets.only(top: 8),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: selectedCartonList
|
||||
.map((e) => Padding(
|
||||
padding: const EdgeInsets.only(right: 20),
|
||||
child: Text(e.cartonNumber ?? "",
|
||||
style:
|
||||
TextStyle(color: Colors.black, fontSize: 15)),
|
||||
))
|
||||
.toList())),
|
||||
);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
@@ -174,10 +204,27 @@ class _CartonSelectionWidgetState extends State<CartonSelectionWidget> {
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 5),
|
||||
LocalTitle(textKey: "box.select.cartion"),
|
||||
const SizedBox(height: 10),
|
||||
searchBox,
|
||||
AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
transitionBuilder:
|
||||
(Widget child, Animation<double> animation) =>
|
||||
FadeTransition(
|
||||
opacity: animation,
|
||||
child: SizeTransition(
|
||||
sizeFactor: animation,
|
||||
axis: Axis.vertical,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
child: _down
|
||||
? Column(children: [
|
||||
const SizedBox(height: 5),
|
||||
LocalTitle(textKey: "box.select.cartion"),
|
||||
const SizedBox(height: 10),
|
||||
searchBox,
|
||||
selectedCartonBox
|
||||
])
|
||||
: const SizedBox()),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(top: 10),
|
||||
@@ -187,6 +234,9 @@ class _CartonSelectionWidgetState extends State<CartonSelectionWidget> {
|
||||
onLoadMore: _loadMoreData,
|
||||
onRefresh: () async {
|
||||
_init();
|
||||
setState(() {
|
||||
_down = true;
|
||||
});
|
||||
},
|
||||
onTap: (a) async {
|
||||
setState(() {
|
||||
|
||||
Reference in New Issue
Block a user