|
|
|
@ -1,4 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
import 'dart:developer';
|
|
|
|
import 'dart:developer';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
@ -103,32 +102,30 @@ class _CostCenterFormViewState extends State<CostCenterFormView> {
|
|
|
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
|
|
|
appBar: DefaultAppBar(
|
|
|
|
appBar: DefaultAppBar(
|
|
|
|
title: 'Cost Center for Item'.addTranslation,
|
|
|
|
title: 'Cost Center for Item'.addTranslation,
|
|
|
|
onBackPress: () {
|
|
|
|
// onBackPress: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
// Navigator.pop(context);
|
|
|
|
},
|
|
|
|
// },
|
|
|
|
),
|
|
|
|
),
|
|
|
|
body: Consumer<AssetDeliveryProvider>(builder: (context, provider, child) {
|
|
|
|
body: Consumer<AssetDeliveryProvider>(builder: (context, provider, child) {
|
|
|
|
return Column(
|
|
|
|
return provider.isLoading
|
|
|
|
children: [
|
|
|
|
? const CircularProgressIndicator(color: AppColor.primary10).center
|
|
|
|
itemDetails(context: context, itemNo: widget.itemNo, itemDescription: widget.itemDescription),
|
|
|
|
: Column(
|
|
|
|
provider.isLoading
|
|
|
|
children: [
|
|
|
|
? const CircularProgressIndicator(color: AppColor.primary10).center
|
|
|
|
itemDetails(context: context, itemNo: widget.itemNo, itemDescription: widget.itemDescription),
|
|
|
|
: ListView.builder(
|
|
|
|
ListView.builder(
|
|
|
|
itemCount: _list.length + 1,
|
|
|
|
itemCount: _list.length + 1,
|
|
|
|
shrinkWrap: true,
|
|
|
|
shrinkWrap: true,
|
|
|
|
padding: EdgeInsets.all(widget.cardPadding ?? 16),
|
|
|
|
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16, top: 8),
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
if (index == _list.length) {
|
|
|
|
if (index == _list.length) {
|
|
|
|
return Visibility(
|
|
|
|
return AppFilledButton(
|
|
|
|
child: AppFilledButton(
|
|
|
|
label: "Add Cost Center".addTranslation,
|
|
|
|
label: "Add Cost Center".addTranslation,
|
|
|
|
maxWidth: true,
|
|
|
|
maxWidth: true,
|
|
|
|
textColor: AppColor.textColor(context),
|
|
|
|
textColor: AppColor.textColor(context),
|
|
|
|
buttonColor: context.isDark ? AppColor.neutral60 : AppColor.white10,
|
|
|
|
buttonColor: context.isDark ? AppColor.neutral60 : AppColor.white10,
|
|
|
|
icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)),
|
|
|
|
icon: Icon(Icons.add_circle, color: AppColor.blueStatus(context)),
|
|
|
|
showIcon: true,
|
|
|
|
showIcon: true,
|
|
|
|
onPressed: _addNewEntry,
|
|
|
|
onPressed: _addNewEntry,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return CostCenterItemCard(
|
|
|
|
return CostCenterItemCard(
|
|
|
|
@ -142,28 +139,27 @@ class _CostCenterFormViewState extends State<CostCenterFormView> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
).expanded,
|
|
|
|
).expanded,
|
|
|
|
8.height,
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
FooterActionButton.footerContainer(
|
|
|
|
context: context,
|
|
|
|
context: context,
|
|
|
|
child: AppFilledButton(
|
|
|
|
child: AppFilledButton(
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
buttonColor: AppColor.primary10,
|
|
|
|
label: 'Save'.addTranslation,
|
|
|
|
label: 'Save'.addTranslation,
|
|
|
|
maxWidth: true,
|
|
|
|
maxWidth: true,
|
|
|
|
onPressed: () async {
|
|
|
|
onPressed: () async {
|
|
|
|
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
|
|
|
|
showDialog(context: context, barrierDismissible: false, builder: (context) => const AppLazyLoading());
|
|
|
|
await assetDeliveryProvider.saveCostCenterToLineDeliveryInspection(tableItemId: widget.tableItemId, lineId: widget.lineId, list: _list).then((status) async {
|
|
|
|
await assetDeliveryProvider.saveCostCenterToLineDeliveryInspection(tableItemId: widget.tableItemId, lineId: widget.lineId, list: _list).then((status) async {
|
|
|
|
Navigator.pop(context);
|
|
|
|
Navigator.pop(context);
|
|
|
|
if (status) {
|
|
|
|
if (status) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
Navigator.pop(context);
|
|
|
|
assetDeliveryProvider.getDeliveryLinesListById(
|
|
|
|
assetDeliveryProvider.getDeliveryLinesListById(
|
|
|
|
itemId: widget.tableItemId,
|
|
|
|
itemId: widget.tableItemId,
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -172,6 +168,7 @@ class _CostCenterFormViewState extends State<CostCenterFormView> {
|
|
|
|
Widget itemDetails({required BuildContext context, String? itemNo, String? itemDescription}) {
|
|
|
|
Widget itemDetails({required BuildContext context, String? itemNo, String? itemDescription}) {
|
|
|
|
return Column(
|
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
'Item No'.addTranslation,
|
|
|
|
'Item No'.addTranslation,
|
|
|
|
@ -197,7 +194,8 @@ Widget itemDetails({required BuildContext context, String? itemNo, String? itemD
|
|
|
|
context,
|
|
|
|
context,
|
|
|
|
borderRadius: 20,
|
|
|
|
borderRadius: 20,
|
|
|
|
padding: 12,
|
|
|
|
padding: 12,
|
|
|
|
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
|
|
|
showShadow: false,
|
|
|
|
|
|
|
|
margin: const EdgeInsets.only(left: 16, right: 16, top: 16, bottom: 8),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -293,6 +291,6 @@ class CostCenterItemCard extends StatelessWidget {
|
|
|
|
],
|
|
|
|
],
|
|
|
|
)
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).toShadowContainer(context, paddingObject: const EdgeInsets.symmetric(horizontal: 16, vertical: 12)).paddingOnly(bottom: 12);
|
|
|
|
).toShadowContainer(context, paddingObject: const EdgeInsets.symmetric(horizontal: 12, vertical: 12)).paddingOnly(bottom: 12);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|