merge with prativa
commit
b8ca71ac78
|
@ -332,7 +332,7 @@
|
||||||
"languageVersion": "3.6"
|
"languageVersion": "3.6"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"generated": "2025-02-07T12:15:28.694039Z",
|
"generated": "2025-02-07T12:18:47.126414Z",
|
||||||
"generator": "pub",
|
"generator": "pub",
|
||||||
"generatorVersion": "3.6.0",
|
"generatorVersion": "3.6.0",
|
||||||
"flutterRoot": "file:///C:/Users/Admin/Downloads/flutter_windows_3.27.1-stable/flutter",
|
"flutterRoot": "file:///C:/Users/Admin/Downloads/flutter_windows_3.27.1-stable/flutter",
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
|
||||||
|
|
||||||
import 'package:shayog/components/styles/app_colors.dart';
|
import 'package:shayog/components/styles/app_colors.dart';
|
||||||
import 'package:shayog/components/styles/textStyles.dart';
|
import 'package:shayog/components/styles/textStyles.dart';
|
||||||
|
|
||||||
|
@ -8,7 +6,8 @@ class CustomDropdown<T> extends StatefulWidget {
|
||||||
final List<T> items;
|
final List<T> items;
|
||||||
final String Function(T) itemLabel;
|
final String Function(T) itemLabel;
|
||||||
final Function(T?) onSelected;
|
final Function(T?) onSelected;
|
||||||
final String hintText;
|
VoidCallback? onTap;
|
||||||
|
late final String hintText;
|
||||||
final bool enableSearch;
|
final bool enableSearch;
|
||||||
final double? width;
|
final double? width;
|
||||||
final EdgeInsetsGeometry padding;
|
final EdgeInsetsGeometry padding;
|
||||||
|
@ -18,8 +17,9 @@ class CustomDropdown<T> extends StatefulWidget {
|
||||||
final Color? borderClr;
|
final Color? borderClr;
|
||||||
final Color? backClr;
|
final Color? backClr;
|
||||||
final String? Function(T?)? validator;
|
final String? Function(T?)? validator;
|
||||||
|
Widget? icon;
|
||||||
|
|
||||||
const CustomDropdown({
|
CustomDropdown({
|
||||||
super.key,
|
super.key,
|
||||||
required this.items,
|
required this.items,
|
||||||
required this.itemLabel,
|
required this.itemLabel,
|
||||||
|
@ -34,6 +34,8 @@ class CustomDropdown<T> extends StatefulWidget {
|
||||||
this.borderClr,
|
this.borderClr,
|
||||||
this.backClr,
|
this.backClr,
|
||||||
this.validator,
|
this.validator,
|
||||||
|
this.onTap,
|
||||||
|
this.icon,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -77,8 +79,6 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _selectItem(T item) {
|
void _selectItem(T item) {
|
||||||
setState(() {
|
setState(() {
|
||||||
selectedItem = item;
|
selectedItem = item;
|
||||||
|
@ -98,7 +98,13 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
|
||||||
_openDropdown();
|
_openDropdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void clearField() {
|
||||||
|
setState(() {
|
||||||
|
|
||||||
|
selectedItem = null; // Clear the selected item
|
||||||
|
});
|
||||||
|
_openDropdown();
|
||||||
|
}
|
||||||
void _openDropdown() {
|
void _openDropdown() {
|
||||||
setState(() {
|
setState(() {
|
||||||
isSearching = false;
|
isSearching = false;
|
||||||
|
@ -198,6 +204,7 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
|
||||||
style: 11.txtSBoldGrey,
|
style: 11.txtSBoldGrey,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
// onTap: widget.onTap,
|
||||||
onTap: () => _selectItem(item),
|
onTap: () => _selectItem(item),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -226,30 +233,9 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
|
||||||
overlayEntry!.markNeedsBuild();
|
overlayEntry!.markNeedsBuild();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// String? validateAndGetErrorText() {
|
|
||||||
// setState(() {
|
|
||||||
// _errorText = widget.validator?.call(selectedItem);
|
|
||||||
// });
|
|
||||||
// return _errorText;
|
|
||||||
// }
|
|
||||||
String? validateAndGetErrorText() {
|
|
||||||
setState(() {
|
|
||||||
_errorText = selectedItem == null ? "This field is required" : null;
|
|
||||||
});
|
|
||||||
return _errorText;
|
|
||||||
}
|
|
||||||
void _onDropdownTap() {
|
|
||||||
if (selectedItem == null) {
|
|
||||||
setState(() {
|
|
||||||
_errorText = "Please select an item.";
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
_errorText = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_toggleDropdown();
|
|
||||||
}
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Column(
|
return Column(
|
||||||
|
@ -258,7 +244,7 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
|
||||||
CompositedTransformTarget(
|
CompositedTransformTarget(
|
||||||
link: layerLink,
|
link: layerLink,
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: _toggleDropdown,
|
onTap: _toggleDropdown,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.symmetric(
|
padding: EdgeInsets.symmetric(
|
||||||
vertical: widget.isHeight ? 12 : 6.4, horizontal: 16),
|
vertical: widget.isHeight ? 12 : 6.4, horizontal: 16),
|
||||||
|
@ -277,338 +263,38 @@ class _CustomDropdownState<T> extends State<CustomDropdown<T>> {
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
widget.hintText,
|
widget.hintText,
|
||||||
// selectedItem != null
|
|
||||||
// ? widget.itemLabel(selectedItem as T)
|
// selectedItem == null ? widget.hintText : widget.itemLabel(selectedItem as T),
|
||||||
// : widget.hintText,
|
|
||||||
|
|
||||||
style: 11.txtSBoldGrey,
|
style: 11.txtSBoldGrey,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
// Text(
|
|
||||||
// selectedItem != null
|
|
||||||
// ? widget.itemLabel(selectedItem as T)
|
|
||||||
// : widget.hintText,
|
|
||||||
// style: 12.txtSBoldGrey,
|
|
||||||
// overflow: TextOverflow.ellipsis,
|
|
||||||
// ),
|
|
||||||
),
|
),
|
||||||
const Icon(
|
// selectedItem != null
|
||||||
Icons.keyboard_arrow_down_outlined,
|
// ? InkWell(
|
||||||
size: 20,
|
// onTap: (){
|
||||||
color: Colors.black,
|
// setState(() {
|
||||||
),
|
//
|
||||||
],
|
// selectedItem = null;
|
||||||
),
|
//
|
||||||
),
|
// });
|
||||||
),
|
//
|
||||||
),
|
// _openDropdown();
|
||||||
if (_errorText != null)
|
// },
|
||||||
Padding(
|
//
|
||||||
padding: const EdgeInsets.only(top: 8.0),
|
// child:
|
||||||
child: Text(
|
// Icon(Icons.close, size: 14, color: Colors.black))
|
||||||
_errorText!,
|
// :
|
||||||
style: TextStyle(
|
widget.icon ?? InkWell(
|
||||||
color: Colors.red,
|
onTap: _toggleDropdown,
|
||||||
fontSize: 12,
|
child: Icon(
|
||||||
),
|
Icons.keyboard_arrow_down_outlined,
|
||||||
),
|
size: 20,
|
||||||
)
|
color: Colors.black,
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class CustomDrop<T> extends StatefulWidget {
|
|
||||||
final List<T> items;
|
|
||||||
final String Function(T) itemLabel;
|
|
||||||
final Function(T?) onSelected;
|
|
||||||
final RxString hintText;
|
|
||||||
final bool enableSearch;
|
|
||||||
final double? width;
|
|
||||||
final EdgeInsetsGeometry padding;
|
|
||||||
final T? initialValue;
|
|
||||||
final bool showError;
|
|
||||||
final bool isHeight;
|
|
||||||
final Color? borderClr;
|
|
||||||
final Color? backClr;
|
|
||||||
final String? Function(T?)? validator;
|
|
||||||
|
|
||||||
const CustomDrop({
|
|
||||||
super.key,
|
|
||||||
required this.items,
|
|
||||||
required this.itemLabel,
|
|
||||||
required this.onSelected,
|
|
||||||
required this.hintText,
|
|
||||||
this.enableSearch = true,
|
|
||||||
this.width,
|
|
||||||
this.padding = const EdgeInsets.all(8.0),
|
|
||||||
this.initialValue,
|
|
||||||
this.showError = false,
|
|
||||||
this.isHeight = false,
|
|
||||||
this.borderClr,
|
|
||||||
this.backClr,
|
|
||||||
this.validator,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
_CustomDropdownState<T> createState() => _CustomDropdownState<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _CustomDropState<T> extends State<CustomDrop<T>> {
|
|
||||||
T? selectedItem;
|
|
||||||
String? _errorText;
|
|
||||||
List<T> filteredItems = [];
|
|
||||||
late TextEditingController searchController;
|
|
||||||
OverlayEntry? overlayEntry;
|
|
||||||
final LayerLink layerLink = LayerLink();
|
|
||||||
bool isDropdownOpen = false;
|
|
||||||
bool isSearching = false;
|
|
||||||
final dropdownKey = GlobalKey<_CustomDropdownState>();
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
searchController = TextEditingController();
|
|
||||||
filteredItems = List.from(widget.items);
|
|
||||||
|
|
||||||
if (widget.initialValue != null) {
|
|
||||||
selectedItem = widget.initialValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
searchController.addListener(() {
|
|
||||||
final text = searchController.text;
|
|
||||||
if (text.isEmpty) {
|
|
||||||
setState(() {
|
|
||||||
isSearching = false;
|
|
||||||
filteredItems = List.from(widget.items);
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
isSearching = true;
|
|
||||||
_filterList(text);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void _selectItem(T item) {
|
|
||||||
setState(() {
|
|
||||||
selectedItem = item;
|
|
||||||
isDropdownOpen = false;
|
|
||||||
_errorText = null; // Clear error when an item is selected
|
|
||||||
});
|
|
||||||
searchController.clear();
|
|
||||||
widget.onSelected(item);
|
|
||||||
_closeDropdown();
|
|
||||||
filteredItems = List.from(widget.items);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _toggleDropdown() {
|
|
||||||
if (isDropdownOpen) {
|
|
||||||
_closeDropdown();
|
|
||||||
} else {
|
|
||||||
_openDropdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _openDropdown() {
|
|
||||||
setState(() {
|
|
||||||
isSearching = false;
|
|
||||||
filteredItems = List.from(widget.items);
|
|
||||||
searchController.clear();
|
|
||||||
});
|
|
||||||
|
|
||||||
overlayEntry = _createOverlayEntry();
|
|
||||||
Overlay.of(context).insert(overlayEntry!);
|
|
||||||
|
|
||||||
setState(() {
|
|
||||||
isDropdownOpen = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void _closeDropdown() {
|
|
||||||
overlayEntry?.remove();
|
|
||||||
overlayEntry = null;
|
|
||||||
setState(() {
|
|
||||||
isDropdownOpen = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
OverlayEntry _createOverlayEntry() {
|
|
||||||
final RenderBox renderBox = context.findRenderObject() as RenderBox;
|
|
||||||
|
|
||||||
return OverlayEntry(
|
|
||||||
builder: (context) {
|
|
||||||
return GestureDetector(
|
|
||||||
behavior: HitTestBehavior.opaque,
|
|
||||||
onTap: _closeDropdown,
|
|
||||||
child: Stack(
|
|
||||||
children: [
|
|
||||||
Positioned(
|
|
||||||
width: widget.width ?? 250,
|
|
||||||
child: CompositedTransformFollower(
|
|
||||||
link: layerLink,
|
|
||||||
showWhenUnlinked: false,
|
|
||||||
offset: Offset(0, renderBox.size.height + 5),
|
|
||||||
child: Material(
|
|
||||||
elevation: 4,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.all(8.0),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.white,
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
border: Border.all(
|
|
||||||
color: Colors.grey,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
if (widget.enableSearch && widget.items.length > 1)
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(bottom: 8.0),
|
|
||||||
child: SizedBox(
|
|
||||||
height: 32,
|
|
||||||
child: TextFormField(
|
|
||||||
// validator: widget.validator,
|
|
||||||
enabled: widget.enableSearch,
|
|
||||||
controller: searchController,
|
|
||||||
style: 12.txtSBoldGrey,
|
|
||||||
autovalidateMode:
|
|
||||||
AutovalidateMode.onUserInteraction,
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: 'Search...',
|
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 8.0,
|
|
||||||
horizontal: 12.0,
|
|
||||||
),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
constraints: BoxConstraints(maxHeight: 200),
|
|
||||||
child: ListView.builder(
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemCount: filteredItems.length,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
final item = filteredItems[index];
|
|
||||||
return ListTile(
|
|
||||||
contentPadding: EdgeInsets.all(0),
|
|
||||||
minVerticalPadding: 0,
|
|
||||||
dense: true,
|
|
||||||
visualDensity: VisualDensity.compact,
|
|
||||||
title: Tooltip(
|
|
||||||
message: widget.itemLabel(item),
|
|
||||||
child: Text(
|
|
||||||
widget.itemLabel(item),
|
|
||||||
style: 11.txtSBoldGrey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onTap: () => _selectItem(item),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _filterList(String query) {
|
|
||||||
filteredItems = widget.items
|
|
||||||
.where((item) =>
|
|
||||||
widget.itemLabel(item).toLowerCase().contains(query.toLowerCase()))
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
if (overlayEntry != null) {
|
|
||||||
overlayEntry!.markNeedsBuild();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// String? validateAndGetErrorText() {
|
|
||||||
// setState(() {
|
|
||||||
// _errorText = widget.validator?.call(selectedItem);
|
|
||||||
// });
|
|
||||||
// return _errorText;
|
|
||||||
// }
|
|
||||||
String? validateAndGetErrorText() {
|
|
||||||
setState(() {
|
|
||||||
_errorText = selectedItem == null ? "This field is required" : null;
|
|
||||||
});
|
|
||||||
return _errorText;
|
|
||||||
}
|
|
||||||
void _onDropdownTap() {
|
|
||||||
if (selectedItem == null) {
|
|
||||||
setState(() {
|
|
||||||
_errorText = "Please select an item.";
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
setState(() {
|
|
||||||
_errorText = null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
_toggleDropdown();
|
|
||||||
}
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
CompositedTransformTarget(
|
|
||||||
link: layerLink,
|
|
||||||
child: GestureDetector(
|
|
||||||
onTap: _toggleDropdown,
|
|
||||||
child: Container(
|
|
||||||
padding: EdgeInsets.symmetric(
|
|
||||||
vertical: widget.isHeight ? 12 : 6.4, horizontal: 16),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: widget.backClr ?? AppColors.white,
|
|
||||||
border: Border.all(
|
|
||||||
color: widget.borderClr ?? Colors.transparent,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
borderRadius: BorderRadius.circular(2),
|
|
||||||
),
|
|
||||||
child: Row(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Text(
|
|
||||||
selectedItem != null
|
|
||||||
? widget.itemLabel(selectedItem as T)
|
|
||||||
: widget.hintText.value,
|
|
||||||
style: 11.txtSBoldGrey,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
// Text(
|
|
||||||
// selectedItem != null
|
|
||||||
// ? widget.itemLabel(selectedItem as T)
|
|
||||||
// : widget.hintText,
|
|
||||||
// style: 12.txtSBoldGrey,
|
|
||||||
// overflow: TextOverflow.ellipsis,
|
|
||||||
// ),
|
|
||||||
),
|
|
||||||
const Icon(
|
|
||||||
Icons.keyboard_arrow_down_outlined,
|
|
||||||
size: 20,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
import 'package:get/get.dart';
|
||||||
|
|
||||||
|
class DropdownController extends GetxController {
|
||||||
|
// Observable selected item
|
||||||
|
var selectedItem = Rxn<String>(); // Replace `String` with your actual type if necessary
|
||||||
|
|
||||||
|
// Set the selected value
|
||||||
|
void selectItem(String item) {
|
||||||
|
selectedItem.value = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clear the selected value
|
||||||
|
void clearSelection() {
|
||||||
|
selectedItem.value = null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
// import 'package:flutter/material.dart';
|
||||||
|
// import 'package:get/get.dart';
|
||||||
|
//
|
||||||
|
// import 'drop_down_ctrl.dart';
|
||||||
|
//
|
||||||
|
// class Customdown extends StatelessWidget {
|
||||||
|
// // Instantiate the controller using Get.put() to make it accessible across the app
|
||||||
|
// final DropdownController dropdownController = Get.put(DropdownController());
|
||||||
|
//
|
||||||
|
// @override
|
||||||
|
// Widget build(BuildContext context) {
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// return Obx(
|
||||||
|
// () {
|
||||||
|
// return GestureDetector(
|
||||||
|
// onTap: () async {
|
||||||
|
// // Open the custom dropdown menu on tap
|
||||||
|
// String? selectedItem = await showMenu<String>(
|
||||||
|
// context: context,
|
||||||
|
// position: RelativeRect.fromLTRB(100.0, 100.0, 100.0, 100.0),
|
||||||
|
// items: dropdownController.items
|
||||||
|
// .map((String value) {
|
||||||
|
// return PopupMenuItem<String>(
|
||||||
|
// value: value,
|
||||||
|
// child: Text(value),
|
||||||
|
// );
|
||||||
|
// })
|
||||||
|
// .toList(),
|
||||||
|
// );
|
||||||
|
// // Update the selected value using GetX when the user selects an item
|
||||||
|
// if (selectedItem != null) {
|
||||||
|
// dropdownController.updateValue(selectedItem);
|
||||||
|
// }
|
||||||
|
// },
|
||||||
|
// child: Container(
|
||||||
|
// padding: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
|
||||||
|
// decoration: BoxDecoration(
|
||||||
|
// border: Border.all(color: Colors.blue),
|
||||||
|
// borderRadius: BorderRadius.circular(5),
|
||||||
|
// ),
|
||||||
|
// child: Text(
|
||||||
|
// dropdownController.selectedValue.value, // Reactive update
|
||||||
|
// style: TextStyle(fontSize: 18, color: Colors.black),
|
||||||
|
// ),
|
||||||
|
// ),
|
||||||
|
// );
|
||||||
|
// },
|
||||||
|
// );
|
||||||
|
// }
|
||||||
|
// }
|
|
@ -6,6 +6,7 @@ import '../../../../../components/common/common_btn.dart';
|
||||||
import '../../../../../components/common/common_button.dart';
|
import '../../../../../components/common/common_button.dart';
|
||||||
import '../../../../../components/common/custom_drop_down.dart';
|
import '../../../../../components/common/custom_drop_down.dart';
|
||||||
import '../../../../../components/common/data_cell.dart';
|
import '../../../../../components/common/data_cell.dart';
|
||||||
|
|
||||||
import '../../../../../components/styles/app_colors.dart';
|
import '../../../../../components/styles/app_colors.dart';
|
||||||
import '../../../../../components/styles/app_strings.dart';
|
import '../../../../../components/styles/app_strings.dart';
|
||||||
import '../../../widgets/custom_pagination.dart';
|
import '../../../widgets/custom_pagination.dart';
|
||||||
|
@ -43,19 +44,29 @@ class ManageUser extends StatelessWidget {
|
||||||
text: "User Name",
|
text: "User Name",
|
||||||
),
|
),
|
||||||
SizedBox(height: 4),
|
SizedBox(height: 4),
|
||||||
GetX<DashboardCtrl>(
|
CustomDropdown(
|
||||||
builder: (ctrl) {
|
icon: controller.selectUser.value ==
|
||||||
return CustomDropdown(
|
"Select User Name"
|
||||||
backClr: AppColors.clrD9,
|
?Icon(
|
||||||
borderClr: AppColors.clrGrey,
|
Icons.keyboard_arrow_down_outlined,
|
||||||
items: ctrl.userNames,
|
size: 20,
|
||||||
itemLabel: (item) => item,
|
color: Colors.black,
|
||||||
onSelected: (selected) {
|
) : GestureDetector(
|
||||||
ctrl.selectUser.value = selected;
|
onTap: () {
|
||||||
},
|
controller.selectUser.value =
|
||||||
hintText: ctrl.selectUser.value);
|
"Select User Name";
|
||||||
},
|
},
|
||||||
),
|
child: Icon(Icons.close,size: 14)),
|
||||||
|
|
||||||
|
backClr: AppColors.clrD9,
|
||||||
|
borderClr: AppColors.clrGrey,
|
||||||
|
items: controller.userNames,
|
||||||
|
itemLabel: (item) => item,
|
||||||
|
onSelected: (selected) {
|
||||||
|
controller.selectUser.value =
|
||||||
|
selected ?? "";
|
||||||
|
},
|
||||||
|
hintText: controller.selectUser.value),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
|
@ -68,19 +79,27 @@ class ManageUser extends StatelessWidget {
|
||||||
text: "User Type",
|
text: "User Type",
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
GetX<DashboardCtrl>(
|
CustomDropdown(
|
||||||
builder: (controller) {
|
icon: controller.selectType.value ==
|
||||||
return CustomDropdown(
|
"Select UserType"
|
||||||
backClr: AppColors.clrD9,
|
?Icon(
|
||||||
borderClr: AppColors.clrGrey,
|
Icons.keyboard_arrow_down_outlined,
|
||||||
items: controller.userTypesNames,
|
size: 20,
|
||||||
itemLabel: (item) => item,
|
color: Colors.black,
|
||||||
onSelected: (selected) {
|
) : GestureDetector(
|
||||||
controller.selectType.value = selected;
|
onTap: () {
|
||||||
|
controller.selectType.value =
|
||||||
|
"Select UserType";
|
||||||
},
|
},
|
||||||
hintText: controller.selectType.value);
|
child: Icon(Icons.close,size: 14)),
|
||||||
},
|
backClr: AppColors.clrD9,
|
||||||
),
|
borderClr: AppColors.clrGrey,
|
||||||
|
items: controller.userTypesNames,
|
||||||
|
itemLabel: (item) => item,
|
||||||
|
onSelected: (selected) {
|
||||||
|
controller.selectType.value = selected;
|
||||||
|
},
|
||||||
|
hintText: controller.selectType.value),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
SizedBox(width: 16),
|
SizedBox(width: 16),
|
||||||
|
@ -94,13 +113,24 @@ class ManageUser extends StatelessWidget {
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
CustomDropdown(
|
||||||
|
icon: controller.selectEmail.value ==
|
||||||
|
"Select Email"
|
||||||
|
?Icon(
|
||||||
|
Icons.keyboard_arrow_down_outlined,
|
||||||
|
size: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
) : GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
controller.selectEmail.value =
|
||||||
|
"Select Email";
|
||||||
|
},
|
||||||
|
child: Icon(Icons.close,size: 14)),
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
borderClr: AppColors.clrGrey,
|
borderClr: AppColors.clrGrey,
|
||||||
items: controller.userEmail,
|
items: controller.userEmail,
|
||||||
itemLabel: (item) => item,
|
itemLabel: (item) => item,
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
controller.selectEmail.value = selected;
|
controller.selectEmail.value = selected;
|
||||||
|
|
||||||
},
|
},
|
||||||
hintText: controller.selectEmail.value),
|
hintText: controller.selectEmail.value),
|
||||||
],
|
],
|
||||||
|
@ -120,6 +150,18 @@ class ManageUser extends StatelessWidget {
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
CustomDropdown(
|
||||||
|
icon: controller.selectCode.value ==
|
||||||
|
"Select Employee Code"
|
||||||
|
?Icon(
|
||||||
|
Icons.keyboard_arrow_down_outlined,
|
||||||
|
size: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
) : GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
controller.selectCode.value =
|
||||||
|
"Select Employee Code";
|
||||||
|
},
|
||||||
|
child: Icon(Icons.close,size: 14)),
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
borderClr: AppColors.clrGrey,
|
borderClr: AppColors.clrGrey,
|
||||||
items: controller.userEmpCode,
|
items: controller.userEmpCode,
|
||||||
|
@ -141,7 +183,18 @@ class ManageUser extends StatelessWidget {
|
||||||
),
|
),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
CustomDropdown(
|
||||||
|
icon: controller.selectUserStatus.value ==
|
||||||
|
"Select Status"
|
||||||
|
?Icon(
|
||||||
|
Icons.keyboard_arrow_down_outlined,
|
||||||
|
size: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
) : GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
controller.selectUserStatus.value =
|
||||||
|
"Select Status";
|
||||||
|
},
|
||||||
|
child: Icon(Icons.close,size: 14)),
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
borderClr: AppColors.clrGrey,
|
borderClr: AppColors.clrGrey,
|
||||||
items: controller.userStatus,
|
items: controller.userStatus,
|
||||||
|
@ -179,7 +232,6 @@ class ManageUser extends StatelessWidget {
|
||||||
text: AppStrings.submit,
|
text: AppStrings.submit,
|
||||||
textStyle: 14.txtSBoldWhite,
|
textStyle: 14.txtSBoldWhite,
|
||||||
clickAction: () {
|
clickAction: () {
|
||||||
//controller.isSelected.value = false;
|
|
||||||
controller.getManageUser();
|
controller.getManageUser();
|
||||||
controller.getAllUser();
|
controller.getAllUser();
|
||||||
},
|
},
|
||||||
|
@ -211,7 +263,7 @@ class ManageUser extends StatelessWidget {
|
||||||
decoration:
|
decoration:
|
||||||
BoxDecoration(border: Border.all(color: AppColors.clrGrey)),
|
BoxDecoration(border: Border.all(color: AppColors.clrGrey)),
|
||||||
child: RawScrollbar(
|
child: RawScrollbar(
|
||||||
thumbColor: AppColors.clrD9,
|
thumbColor: AppColors.primaryClr.withOpacity(0.4),
|
||||||
radius: Radius.circular(2),
|
radius: Radius.circular(2),
|
||||||
trackVisibility: true,
|
trackVisibility: true,
|
||||||
thumbVisibility: true,
|
thumbVisibility: true,
|
||||||
|
@ -220,7 +272,7 @@ class ManageUser extends StatelessWidget {
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
controller: controller.verticalScrollController,
|
controller: controller.verticalScrollController,
|
||||||
child: RawScrollbar(
|
child: RawScrollbar(
|
||||||
thumbColor: AppColors.clrD9,
|
thumbColor: AppColors.primaryClr.withOpacity(0.4),
|
||||||
radius: Radius.circular(2),
|
radius: Radius.circular(2),
|
||||||
thickness: 14,
|
thickness: 14,
|
||||||
trackVisibility: true,
|
trackVisibility: true,
|
||||||
|
|
|
@ -111,6 +111,7 @@ class DashboardCtrl extends GetxController {
|
||||||
RxList<AllUser> getAllUserMain = <AllUser>[].obs;
|
RxList<AllUser> getAllUserMain = <AllUser>[].obs;
|
||||||
RxInt limit = 20.obs;
|
RxInt limit = 20.obs;
|
||||||
var userLoading = false.obs;
|
var userLoading = false.obs;
|
||||||
|
var changeColor = false.obs;
|
||||||
|
|
||||||
setNextPage() {
|
setNextPage() {
|
||||||
if (currentPage.value < totalPages.value.toInt()) {
|
if (currentPage.value < totalPages.value.toInt()) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
import 'package:shayog/components/common/input_field.dart';
|
import 'package:shayog/components/common/input_field.dart';
|
||||||
import 'package:shayog/components/styles/textStyles.dart';
|
import 'package:shayog/components/styles/textStyles.dart';
|
||||||
import 'package:shayog/feature/presentation/screens/transporter/invoice_management/payment_view/ctrl/payment_view_ctrl.dart';
|
import 'package:shayog/feature/presentation/screens/transporter/invoice_management/payment_view/ctrl/payment_view_ctrl.dart';
|
||||||
|
@ -27,7 +28,7 @@ class PaymentView extends StatelessWidget {
|
||||||
() => controller.isPaymentFilter.value
|
() => controller.isPaymentFilter.value
|
||||||
? Container(
|
? Container(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 16.0, top: 8, right: 16, bottom: 16),
|
left: 16.0, top: 8, right: 16),
|
||||||
color: AppColors.clrF2,
|
color: AppColors.clrF2,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
@ -42,17 +43,68 @@ class PaymentView extends StatelessWidget {
|
||||||
children: [
|
children: [
|
||||||
TextView(text: "Plant"),
|
TextView(text: "Plant"),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown(
|
|
||||||
|
CustomDropdown(
|
||||||
|
icon: paymentCtrl.selectedPlant.value ==
|
||||||
|
"Select Plant"
|
||||||
|
? Icon(
|
||||||
|
Icons.keyboard_arrow_down_outlined,
|
||||||
|
size: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
) : GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
paymentCtrl.selectedPlant.value =
|
||||||
|
"Select Plant";
|
||||||
|
},
|
||||||
|
child: Icon(Icons.close,size: 14)),
|
||||||
|
|
||||||
|
backClr: AppColors.clrD9,
|
||||||
|
borderClr: AppColors.clrGrey,
|
||||||
|
items: paymentCtrl.plant,
|
||||||
|
itemLabel: (item) =>
|
||||||
|
"${item.plantCode} - ${item.plantDesc}",
|
||||||
|
onSelected: (selected) {
|
||||||
|
paymentCtrl.selectedPlant.value =
|
||||||
|
"${selected?.plantCode} - ${selected?.plantDesc}";
|
||||||
|
},
|
||||||
|
hintText: paymentCtrl.selectedPlant.value,
|
||||||
|
),
|
||||||
|
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(width: 16),
|
||||||
|
Expanded(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
TextView(text: "Product"),
|
||||||
|
SizedBox(height: 8),
|
||||||
|
CustomDropdown<dynamic>(
|
||||||
|
icon: paymentCtrl.selectedProduct.value ==
|
||||||
|
"Select Product Name"
|
||||||
|
? Icon(
|
||||||
|
Icons.keyboard_arrow_down_outlined,
|
||||||
|
size: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
) : GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
paymentCtrl.selectedProduct.value =
|
||||||
|
"Select Product Name";
|
||||||
|
},
|
||||||
|
child: Icon(Icons.close,size: 14)),
|
||||||
|
width: 250,
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
borderClr: AppColors.clrGrey,
|
borderClr: AppColors.clrGrey,
|
||||||
items: paymentCtrl.plant,
|
items: paymentCtrl.product,
|
||||||
itemLabel: (item) =>
|
itemLabel: (item) =>
|
||||||
"${item.plantCode}-${item.plantDesc}",
|
"${item.materialCode} - ${item.materialDescription}",
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
paymentCtrl.selectedPlant.value =
|
paymentCtrl.selectedProduct.value =
|
||||||
"${selected?.plantCode}-${selected?.plantDesc}";
|
"${selected.materialCode} - ${selected.materialDescription}";
|
||||||
},
|
},
|
||||||
hintText: paymentCtrl.selectedPlant.value,
|
hintText: paymentCtrl.selectedProduct.value,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -66,11 +118,22 @@ class PaymentView extends StatelessWidget {
|
||||||
TextView(text: "Freight Bill No."),
|
TextView(text: "Freight Bill No."),
|
||||||
SizedBox(height: 8),
|
SizedBox(height: 8),
|
||||||
CustomDropdown<String>(
|
CustomDropdown<String>(
|
||||||
|
icon: paymentCtrl.selectedFreightBill.value ==
|
||||||
|
"Select Bill No."
|
||||||
|
? Icon(
|
||||||
|
Icons.keyboard_arrow_down_outlined,
|
||||||
|
size: 20,
|
||||||
|
color: Colors.black,
|
||||||
|
) : GestureDetector(
|
||||||
|
onTap: () {
|
||||||
|
paymentCtrl.selectedFreightBill.value =
|
||||||
|
"Select Bill No.";
|
||||||
|
},
|
||||||
|
child: Icon(Icons.close,size: 14)),
|
||||||
backClr: AppColors.clrD9,
|
backClr: AppColors.clrD9,
|
||||||
borderClr: AppColors.clrGrey,
|
borderClr: AppColors.clrGrey,
|
||||||
items: paymentCtrl.freightBill,
|
items: paymentCtrl.freightBill,
|
||||||
itemLabel: (item) => item,
|
itemLabel: (item) => item,
|
||||||
|
|
||||||
onSelected: (selected) {
|
onSelected: (selected) {
|
||||||
paymentCtrl.selectedFreightBill.value =
|
paymentCtrl.selectedFreightBill.value =
|
||||||
selected.toString();
|
selected.toString();
|
||||||
|
@ -81,30 +144,7 @@ class PaymentView extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(width: 16),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
TextView(text: "Product"),
|
|
||||||
SizedBox(height: 8),
|
|
||||||
CustomDropdown<dynamic>(
|
|
||||||
width: 250,
|
|
||||||
backClr: AppColors.clrD9,
|
|
||||||
borderClr: AppColors.clrGrey,
|
|
||||||
items: paymentCtrl.product,
|
|
||||||
itemLabel: (item) =>
|
|
||||||
"${item.materialCode}-${item.materialDescription}",
|
|
||||||
onSelected: (selected) {
|
|
||||||
paymentCtrl.selectedProduct.value =
|
|
||||||
"${selected.materialCode}-${selected.materialDescription}";
|
|
||||||
},
|
|
||||||
hintText: paymentCtrl.selectedProduct.value,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
SizedBox(height: 12),
|
SizedBox(height: 12),
|
||||||
|
@ -189,11 +229,10 @@ class PaymentView extends StatelessWidget {
|
||||||
? CircularProgressIndicator()
|
? CircularProgressIndicator()
|
||||||
: Container(
|
: Container(
|
||||||
margin: EdgeInsets.only(bottom: 16, top: 8),
|
margin: EdgeInsets.only(bottom: 16, top: 8),
|
||||||
// height: MediaQuery.of(context).size.height * 0.4,
|
decoration: BoxDecoration(
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(color: AppColors.clrGrey)),
|
border: Border.all(color: AppColors.clrGrey)),
|
||||||
child: RawScrollbar(
|
child: RawScrollbar(
|
||||||
thumbColor: AppColors.clrD9,
|
thumbColor: AppColors.primaryClr.withOpacity(0.4),
|
||||||
radius: Radius.circular(2),
|
radius: Radius.circular(2),
|
||||||
trackVisibility: true,
|
trackVisibility: true,
|
||||||
thumbVisibility: true,
|
thumbVisibility: true,
|
||||||
|
@ -202,7 +241,7 @@ class PaymentView extends StatelessWidget {
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
controller: paymentCtrl.verticalScrollController,
|
controller: paymentCtrl.verticalScrollController,
|
||||||
child: RawScrollbar(
|
child: RawScrollbar(
|
||||||
thumbColor: AppColors.clrD9,
|
thumbColor: AppColors.primaryClr.withOpacity(0.4),
|
||||||
radius: Radius.circular(2),
|
radius: Radius.circular(2),
|
||||||
thickness: 14,
|
thickness: 14,
|
||||||
trackVisibility: true,
|
trackVisibility: true,
|
||||||
|
@ -274,8 +313,13 @@ class PaymentView extends StatelessWidget {
|
||||||
index, "${stoppage.materialCode}"),
|
index, "${stoppage.materialCode}"),
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${stoppage.freightbillCode}"),
|
index, "${stoppage.freightbillCode}"),
|
||||||
|
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${stoppage.lastUpdatedOn}"),
|
index,
|
||||||
|
DateFormat('yyyy - MMM dd').format(
|
||||||
|
DateTime.parse(stoppage
|
||||||
|
.lastUpdatedOn
|
||||||
|
.toString()))),
|
||||||
|
|
||||||
editableCell(
|
editableCell(
|
||||||
index, "${stoppage.shipmentNetQty}"),
|
index, "${stoppage.shipmentNetQty}"),
|
||||||
|
|
|
@ -41,327 +41,83 @@ class _TransportViewState extends State<InvoiceManagement> {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
Container(
|
||||||
padding: EdgeInsets.only(bottom: 4),
|
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||||
margin: EdgeInsets.all(16),
|
height: 50,
|
||||||
child: Column(
|
color: AppColors.primaryClr,
|
||||||
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Container(
|
ListView.separated(
|
||||||
margin: EdgeInsets.only(bottom: 12),
|
shrinkWrap: true,
|
||||||
height: 55,
|
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||||
color: AppColors.primaryClr,
|
scrollDirection: Axis.horizontal,
|
||||||
child: Row(
|
itemBuilder: (context, index) {
|
||||||
children: [
|
return Obx(
|
||||||
ListView.separated(
|
() => InkWell(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
|
||||||
scrollDirection: Axis.horizontal,
|
|
||||||
shrinkWrap: true,
|
|
||||||
itemBuilder: (context, index) {
|
|
||||||
return Obx(
|
|
||||||
() => InkWell(
|
|
||||||
onTap: () {
|
|
||||||
ctrl.selectedState.value = index;
|
|
||||||
},
|
|
||||||
child: Container(
|
|
||||||
margin: EdgeInsets.only(bottom: 10, top: 10),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(
|
|
||||||
color: ctrl.selectedState.value ==
|
|
||||||
index
|
|
||||||
? Colors.white
|
|
||||||
: AppColors.primaryClr,
|
|
||||||
width: 3))),
|
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
ctrl.userTabs[index].title ?? "",
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
fontWeight: FontWeight.w900,
|
|
||||||
color: Colors.white),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
separatorBuilder: (context, index) {
|
|
||||||
return SizedBox(width: 16);
|
|
||||||
},
|
|
||||||
itemCount: ctrl.userTabs.length),
|
|
||||||
Spacer(),
|
|
||||||
InkWell(
|
|
||||||
child: Image.asset(AppImages.refresh,
|
|
||||||
height: 10, width: 10)),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Text(
|
|
||||||
AppStrings.refresh,
|
|
||||||
style: TextStyle(
|
|
||||||
color: AppColors.white,
|
|
||||||
fontSize: 10,
|
|
||||||
fontWeight: FontWeight.normal),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
behavior: HitTestBehavior.translucent,
|
|
||||||
onTap: () {
|
onTap: () {
|
||||||
print("cdgsa");
|
ctrl.selectedState.value = index;
|
||||||
ctrl.isSelected.value = !ctrl.isSelected.value;
|
|
||||||
// if (ctrl.isSelected.value == 0) {
|
|
||||||
// ctrl.toggleFilter();
|
|
||||||
// } else if (ctrl.isSelected.value == 1) {
|
|
||||||
// ctrl.toggleViewFreight();
|
|
||||||
// } else if (ctrl.isSelected.value == 2) {
|
|
||||||
// ctrl.togglePending();
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
child: Row(
|
child: Container(
|
||||||
children: [
|
margin: EdgeInsets.only(bottom: 10, top: 10),
|
||||||
Image.asset(AppImages.filter,
|
decoration: BoxDecoration(
|
||||||
height: 16, width: 16),
|
border: Border(
|
||||||
Padding(
|
bottom: BorderSide(
|
||||||
padding: const EdgeInsets.all(8.0),
|
color: ctrl.selectedState.value == index
|
||||||
child: TextView(
|
? Colors.white
|
||||||
text: AppStrings.filter,
|
: AppColors.primaryClr,
|
||||||
style: 12.txtBoldWhite,
|
width: 3))),
|
||||||
),
|
child: Center(
|
||||||
|
child: TextView(
|
||||||
|
text: ctrl.invoiceTabs[index].title ?? "",
|
||||||
|
style: 12.txtBoldWhite,
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
|
},
|
||||||
|
separatorBuilder: (context, index) {
|
||||||
|
return SizedBox(width: 16);
|
||||||
|
},
|
||||||
|
itemCount: ctrl.invoiceTabs.length,
|
||||||
|
),
|
||||||
|
Spacer(),
|
||||||
|
InkWell(
|
||||||
|
onTap: (){
|
||||||
|
paymentCtrl.resetDropdowns();
|
||||||
|
},
|
||||||
|
child: Image.asset(AppImages.refresh, height: 16, width: 16)),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Text(
|
||||||
|
AppStrings.refresh,
|
||||||
|
style: 12.txtBoldWhite,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
InkWell(
|
||||||
|
onTap: () {
|
||||||
|
switch (ctrl.selectedState.value) {
|
||||||
|
case 0:
|
||||||
|
return ctrl.invoiceFilter();
|
||||||
|
case 1:
|
||||||
|
return ctrl.cancelledFilter();
|
||||||
|
case 2:
|
||||||
|
return ctrl.paymentFilter();
|
||||||
|
default:
|
||||||
|
return ctrl.ccnFilter();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Image.asset(AppImages.filter, height: 16, width: 16),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: TextView(
|
||||||
|
text: AppStrings.filter,
|
||||||
|
style: 12.txtBoldWhite,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Obx(
|
|
||||||
() => ctrl.isSelected.value
|
|
||||||
? Container(
|
|
||||||
padding: EdgeInsets.all(8),
|
|
||||||
color: AppColors.clrF2,
|
|
||||||
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
TextView(text: "Plant", isRequired: true),
|
|
||||||
SizedBox(height: 8),
|
|
||||||
CustomDropdown(
|
|
||||||
backClr: AppColors.clrD9,
|
|
||||||
borderClr: AppColors.clrGrey,
|
|
||||||
items: ctrl.plant,
|
|
||||||
|
|
||||||
itemLabel: (item) =>
|
|
||||||
"${item.plantCode} - ${item.plantDesc}",
|
|
||||||
onSelected: (selected) {
|
|
||||||
if (selected != null) {
|
|
||||||
ctrl.selectPlantFreight.value =
|
|
||||||
selected.plantCode ?? "";
|
|
||||||
ctrl.showPlantErrorFreight.value =
|
|
||||||
false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hintText: "Select Plant",
|
|
||||||
),
|
|
||||||
Obx(() =>
|
|
||||||
ctrl.showPlantErrorFreight.value
|
|
||||||
? Text(
|
|
||||||
'Required',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.red,
|
|
||||||
fontSize: 12),
|
|
||||||
)
|
|
||||||
: Text('')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 16),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
TextView(text: "Freight Bill Date",isRequired: true,),
|
|
||||||
Container(
|
|
||||||
height: 35,
|
|
||||||
child: TextFormField(
|
|
||||||
key: ctrl.fromTextFieldKey,
|
|
||||||
controller: ctrl.fromController,
|
|
||||||
onTap: () async {
|
|
||||||
final pickedDate =
|
|
||||||
await showWebDatePicker(
|
|
||||||
width: 20.w,
|
|
||||||
context: ctrl
|
|
||||||
.fromTextFieldKey.currentContext!,
|
|
||||||
initialDate:
|
|
||||||
ctrl.fromSelectedDate,
|
|
||||||
firstDate: DateTime(2000),
|
|
||||||
lastDate: DateTime.now(),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (pickedDate != null) {
|
|
||||||
ctrl.fromSelectedDate =
|
|
||||||
pickedDate;
|
|
||||||
String formattedDate = ctrl
|
|
||||||
.getFormattedDate(pickedDate);
|
|
||||||
ctrl.fromController.text =
|
|
||||||
formattedDate;
|
|
||||||
ctrl.dateCheck.value = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
decoration: InputDecoration(
|
|
||||||
fillColor: AppColors.clrD9,
|
|
||||||
filled: true,
|
|
||||||
hintText: 'Select Freight Bill Date ',
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
overflow: TextOverflow.ellipsis),
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.circular(2.0),
|
|
||||||
borderSide:
|
|
||||||
BorderSide(color: AppColors.black),
|
|
||||||
),
|
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.circular(2.0),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: AppColors.clrGrey),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.circular(2.0),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: AppColors.clrGrey),
|
|
||||||
),
|
|
||||||
disabledBorder: OutlineInputBorder(
|
|
||||||
borderRadius:
|
|
||||||
BorderRadius.circular(2.0),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: AppColors.clrGrey),
|
|
||||||
),
|
|
||||||
suffixIcon: ctrl.dateCheck.value
|
|
||||||
? InkWell(
|
|
||||||
onTap: () {
|
|
||||||
ctrl.dateCheck.value =
|
|
||||||
false;
|
|
||||||
ctrl.fromController
|
|
||||||
.clear();
|
|
||||||
ctrl.fromSelectedDate =
|
|
||||||
DateTime.now();
|
|
||||||
},
|
|
||||||
child: Icon(Icons.close,
|
|
||||||
size: 1.2.w),
|
|
||||||
)
|
|
||||||
: null,
|
|
||||||
contentPadding:
|
|
||||||
const EdgeInsets.symmetric(
|
|
||||||
horizontal: 12.0, vertical: 0.0),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 16),
|
|
||||||
Expanded(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
TextView(
|
|
||||||
text: "Freight Bill No.", isRequired: true),
|
|
||||||
SizedBox(height: 8),
|
|
||||||
CustomDropdown<String>(
|
|
||||||
backClr: AppColors.clrD9,
|
|
||||||
borderClr: AppColors.clrGrey,
|
|
||||||
items: ctrl.freightBill,
|
|
||||||
itemLabel: (item) => item,
|
|
||||||
onSelected: (selected) {
|
|
||||||
if (selected != null) {
|
|
||||||
ctrl.selectFreightBillValidate.value =
|
|
||||||
selected;
|
|
||||||
ctrl.showTransactionErrorViewFreight
|
|
||||||
.value = false;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
hintText: "Select Freight Bill No.",
|
|
||||||
),
|
|
||||||
Obx(() => ctrl
|
|
||||||
.showTransactionErrorViewFreight.value
|
|
||||||
? Text(
|
|
||||||
'Required',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.red, fontSize: 12),
|
|
||||||
)
|
|
||||||
: Text('')),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
// Padding(
|
|
||||||
// padding:
|
|
||||||
// const EdgeInsets.only(top: 16.0, left: 0, right: 8),
|
|
||||||
// child: Row(
|
|
||||||
// children: [
|
|
||||||
// Expanded(
|
|
||||||
// child: Column(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
// crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
// children: [
|
|
||||||
// _commonText(
|
|
||||||
// "Freight Bill Date",
|
|
||||||
// ),
|
|
||||||
// SizedBox(height: 8),
|
|
||||||
// InputField(
|
|
||||||
// title: "Select Bill Date",
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// )),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Expanded(
|
|
||||||
// //flex: 2,
|
|
||||||
// child: Column(
|
|
||||||
// children: [
|
|
||||||
// TextView(
|
|
||||||
// text: "",
|
|
||||||
// ),
|
|
||||||
// Padding(
|
|
||||||
// padding: const EdgeInsets.only(top: 8.0),
|
|
||||||
// child: Row(
|
|
||||||
// mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
// children: [
|
|
||||||
// CommonBtn(
|
|
||||||
// bkClr: Colors.white,
|
|
||||||
// text: AppStrings.cancel,
|
|
||||||
// clickAction: () {},
|
|
||||||
// ),
|
|
||||||
// SizedBox(width: 16),
|
|
||||||
// CommonBtn(
|
|
||||||
// text: AppStrings.submit,
|
|
||||||
// clickAction: () {},
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
// ))
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: SizedBox(),
|
|
||||||
),
|
|
||||||
Obx(() {
|
Obx(() {
|
||||||
switch (ctrl.selectedState.value) {
|
switch (ctrl.selectedState.value) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
Loading…
Reference in New Issue