feat : list view item in out of the province
This commit is contained in:
@@ -4,33 +4,29 @@ import 'package:rasadyar_core/core.dart';
|
||||
class ListItem extends StatelessWidget {
|
||||
const ListItem({
|
||||
super.key,
|
||||
required this.expandList,
|
||||
required this.index,
|
||||
required this.child,
|
||||
required this.secondChild,
|
||||
required this.labelColor,
|
||||
required this.labelIcon,
|
||||
required this.onTap,
|
||||
required this.selected,
|
||||
this.labelIconColor = AppColor.mediumGreyDarkHover,
|
||||
});
|
||||
|
||||
final RxList<int> expandList;
|
||||
final int index;
|
||||
final Widget child;
|
||||
final Widget secondChild;
|
||||
final Color labelColor;
|
||||
final String labelIcon;
|
||||
final Color? labelIconColor;
|
||||
final VoidCallback onTap;
|
||||
final bool selected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
/*if (expandList.contains(index)) {
|
||||
controller.isExpandedList.remove(index);
|
||||
} else {
|
||||
controller.isExpandedList.add(index);
|
||||
}*/
|
||||
},
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: Get.width,
|
||||
margin: const EdgeInsets.fromLTRB(0, 0, 10, 0),
|
||||
@@ -83,7 +79,7 @@ class ListItem extends StatelessWidget {
|
||||
),
|
||||
child: secondChild,
|
||||
),
|
||||
crossFadeState: expandList.contains(index)
|
||||
crossFadeState: selected
|
||||
? CrossFadeState.showSecond
|
||||
: CrossFadeState.showFirst,
|
||||
duration: Duration(milliseconds: 300),
|
||||
@@ -129,3 +125,115 @@ class ListItem extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class ListItem2 extends StatelessWidget {
|
||||
const ListItem2({
|
||||
super.key,
|
||||
required this.index,
|
||||
required this.child,
|
||||
required this.secondChild,
|
||||
required this.labelColor,
|
||||
required this.labelIcon,
|
||||
required this.onTap,
|
||||
required this.selected,
|
||||
this.labelIconColor = AppColor.mediumGreyDarkHover,
|
||||
});
|
||||
|
||||
final int index;
|
||||
final Widget child;
|
||||
final Widget secondChild;
|
||||
final Color labelColor;
|
||||
final String labelIcon;
|
||||
final Color? labelIconColor;
|
||||
final VoidCallback onTap;
|
||||
final bool selected;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: Get.width,
|
||||
margin: const EdgeInsets.fromLTRB(0, 0, 10, 0),
|
||||
decoration: BoxDecoration(
|
||||
color: labelColor,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(width: 1, color: AppColor.lightGreyNormalHover),
|
||||
),
|
||||
child: AnimatedSize(
|
||||
duration: Duration(milliseconds: 400),
|
||||
alignment: Alignment.center,
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.centerRight,
|
||||
children: [
|
||||
AnimatedCrossFade(
|
||||
firstChild: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 75,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
bottomLeft: Radius.zero,
|
||||
bottomRight: Radius.circular(8),
|
||||
topLeft: Radius.zero,
|
||||
topRight: Radius.circular(8),
|
||||
),
|
||||
),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: child,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 20,
|
||||
child: Center(
|
||||
child: SvgGenImage.vec(labelIcon).svg(
|
||||
width: 16.w,
|
||||
height: 16.h,
|
||||
//TODO
|
||||
colorFilter: ColorFilter.mode(labelIconColor ?? AppColor.mediumGreyDarkActive, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
secondChild: Container(
|
||||
padding: EdgeInsets.fromLTRB(8, 8, 12, 12),
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: secondChild,
|
||||
),
|
||||
crossFadeState: selected ? CrossFadeState.showSecond : CrossFadeState.showFirst,
|
||||
duration: Duration(milliseconds: 300),
|
||||
),
|
||||
|
||||
Positioned(
|
||||
right: -12,
|
||||
child: Container(
|
||||
width: index < 999 ? 24 : null,
|
||||
height: index < 999 ? 24 : null,
|
||||
padding: EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.greenLightHover,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
border: Border.all(width: 0.50, color: AppColor.greenDarkActive),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
(index + 1).toString(),
|
||||
style: AppFonts.yekan12.copyWith(color: Colors.black),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
76
packages/chicken/lib/presentation/widget/list_row_item.dart
Normal file
76
packages/chicken/lib/presentation/widget/list_row_item.dart
Normal file
@@ -0,0 +1,76 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
Widget buildRow({
|
||||
required String title,
|
||||
required String value,
|
||||
TextStyle? titleStyle,
|
||||
TextStyle? valueStyle,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
title,
|
||||
textAlign: TextAlign.right,
|
||||
style: titleStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
flex: 2,
|
||||
child: Text(
|
||||
value,
|
||||
textAlign: TextAlign.left,
|
||||
style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildRowOnTapped({
|
||||
String? title,
|
||||
String? value,
|
||||
Widget? titleWidget,
|
||||
Widget? valueWidget,
|
||||
TextStyle? titleStyle,
|
||||
TextStyle? valueStyle,
|
||||
required VoidCallback onTap,
|
||||
}) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 4.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Flexible(
|
||||
flex: 2,
|
||||
child:
|
||||
titleWidget ??
|
||||
Text(
|
||||
title ?? 'N/A',
|
||||
textAlign: TextAlign.right,
|
||||
style: titleStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Flexible(
|
||||
flex: 2,
|
||||
child:
|
||||
valueWidget ??
|
||||
Text(
|
||||
value ?? 'N/A',
|
||||
textAlign: TextAlign.left,
|
||||
style: valueStyle ?? AppFonts.yekan14.copyWith(color: AppColor.darkGreyDarkHover),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user