|
@@ -41,7 +41,7 @@ PreferredSizeWidget appBarTemplate({required BuildContext context, required Stri
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-Widget buttonTemplate({double width = double.infinity, double height = 51, required String text, required action(), backgroundColor = primaryColor, textColor = Colors.white, borderColor = primaryColor}){
|
|
|
|
|
|
|
+Widget buttonTemplate({double width = double.infinity, double height = 51, required String text, required Function() action, backgroundColor = primaryColor, textColor = Colors.white, borderColor = primaryColor}){
|
|
|
return SizedBox(
|
|
return SizedBox(
|
|
|
width: width,
|
|
width: width,
|
|
|
height: height,
|
|
height: height,
|
|
@@ -88,7 +88,7 @@ Widget textHorizontal(String title, String subtitle, {double size = 14, double o
|
|
|
},
|
|
},
|
|
|
),
|
|
),
|
|
|
],
|
|
],
|
|
|
- ):Text("$subtitle", style: TextStyle(color: textColor, fontSize: size), maxLines: 3, overflow: TextOverflow.ellipsis, textAlign: TextAlign.end,),
|
|
|
|
|
|
|
+ ):Text(subtitle, style: TextStyle(color: textColor, fontSize: size), maxLines: 3, overflow: TextOverflow.ellipsis, textAlign: TextAlign.end,),
|
|
|
),
|
|
),
|
|
|
],
|
|
],
|
|
|
);
|
|
);
|
|
@@ -121,13 +121,13 @@ Widget categoryContainer({required BuildContext context, required String iconUrl
|
|
|
|
|
|
|
|
return Container(
|
|
return Container(
|
|
|
padding: EdgeInsets.all(5),
|
|
padding: EdgeInsets.all(5),
|
|
|
- child: Image(image: CachedNetworkImageProvider(iconUrl+'?bridge-cache=true', cacheManager: CacheManager(CacheMan.config(iconUrl+'?bridge-cache=true'))), width: size, height: size),
|
|
|
|
|
decoration: BoxDecoration(
|
|
decoration: BoxDecoration(
|
|
|
color: Colors.white,
|
|
color: Colors.white,
|
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
borderRadius: BorderRadius.all(Radius.circular(20)),
|
|
|
border: Border.all(width: 0.2, color: Colors.black12),
|
|
border: Border.all(width: 0.2, color: Colors.black12),
|
|
|
boxShadow: [BoxShadow(color: Colors.grey.withValues(alpha: 0.3), blurRadius: 2, offset: Offset(0, 2))]
|
|
boxShadow: [BoxShadow(color: Colors.grey.withValues(alpha: 0.3), blurRadius: 2, offset: Offset(0, 2))]
|
|
|
),
|
|
),
|
|
|
|
|
+ child: Image(image: CachedNetworkImageProvider('$iconUrl?bridge-cache=true', cacheManager: CacheManager(CacheMan.config('$iconUrl?bridge-cache=true'))), width: size, height: size),
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -166,6 +166,11 @@ Widget requestTiles({required String image, required String title, required Stri
|
|
|
return Container(
|
|
return Container(
|
|
|
margin: EdgeInsets.symmetric(vertical: vertical),
|
|
margin: EdgeInsets.symmetric(vertical: vertical),
|
|
|
padding: EdgeInsetsDirectional.only(end: border?16:0),
|
|
padding: EdgeInsetsDirectional.only(end: border?16:0),
|
|
|
|
|
+ decoration: BoxDecoration(
|
|
|
|
|
+ color: Colors.white,
|
|
|
|
|
+ border: border?Border.all(color: textColor.withValues(alpha: 0.15)):null,
|
|
|
|
|
+ borderRadius: border?BorderRadius.all(Radius.circular(12)):null
|
|
|
|
|
+ ),
|
|
|
child: Row(
|
|
child: Row(
|
|
|
children: [
|
|
children: [
|
|
|
imageTiles(imageUrl: image),
|
|
imageTiles(imageUrl: image),
|
|
@@ -182,11 +187,6 @@ Widget requestTiles({required String image, required String title, required Stri
|
|
|
)
|
|
)
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
|
- decoration: BoxDecoration(
|
|
|
|
|
- color: Colors.white,
|
|
|
|
|
- border: border?Border.all(color: textColor.withValues(alpha: 0.15)):null,
|
|
|
|
|
- borderRadius: border?BorderRadius.all(Radius.circular(12)):null
|
|
|
|
|
- ),
|
|
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -203,7 +203,7 @@ Widget imageTiles({required String imageUrl, double width = 100, double height =
|
|
|
color: textColor.withValues(alpha: 0.1),
|
|
color: textColor.withValues(alpha: 0.1),
|
|
|
borderRadius: BorderRadius.all(Radius.circular(radius)),
|
|
borderRadius: BorderRadius.all(Radius.circular(radius)),
|
|
|
image: DecorationImage(
|
|
image: DecorationImage(
|
|
|
- image: CachedNetworkImageProvider(imageUrl+'?bridge-cache=true', cacheManager: CacheManager(CacheMan.config(imageUrl+'?bridge-cache=true'))),
|
|
|
|
|
|
|
+ image: CachedNetworkImageProvider('$imageUrl?bridge-cache=true', cacheManager: CacheManager(CacheMan.config('$imageUrl?bridge-cache=true'))),
|
|
|
fit: BoxFit.cover,
|
|
fit: BoxFit.cover,
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
@@ -211,15 +211,24 @@ Widget imageTiles({required String imageUrl, double width = 100, double height =
|
|
|
): Container(
|
|
): Container(
|
|
|
height: height,
|
|
height: height,
|
|
|
width: width,
|
|
width: width,
|
|
|
- child: Center(child: Text("noImage".tr(), style: TextStyle(fontStyle: FontStyle.italic, fontSize: width<100?10:14, color: Colors.black38), maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center,)),
|
|
|
|
|
decoration: BoxDecoration(
|
|
decoration: BoxDecoration(
|
|
|
color: Colors.black12,
|
|
color: Colors.black12,
|
|
|
borderRadius: BorderRadius.all(Radius.circular(12.0))
|
|
borderRadius: BorderRadius.all(Radius.circular(12.0))
|
|
|
),
|
|
),
|
|
|
|
|
+ child: Center(child: Text("noImage".tr(), style: TextStyle(fontStyle: FontStyle.italic, fontSize: width<100?10:14, color: Colors.black38), maxLines: 2, overflow: TextOverflow.ellipsis, textAlign: TextAlign.center,)),
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-Widget loginFieldTemplate({required String value, placeholder = '', required action(value), required submit(value), isPassword = false}){
|
|
|
|
|
|
|
+typedef FieldCallback = void Function(String value);
|
|
|
|
|
+Widget loginFieldTemplate(
|
|
|
|
|
+ {
|
|
|
|
|
+ required String value,
|
|
|
|
|
+ placeholder = '',
|
|
|
|
|
+ required FieldCallback action,
|
|
|
|
|
+ required FieldCallback submit,
|
|
|
|
|
+ isPassword = false
|
|
|
|
|
+ }
|
|
|
|
|
+){
|
|
|
TextEditingController controller = TextEditingController()..text = value;
|
|
TextEditingController controller = TextEditingController()..text = value;
|
|
|
bool hidePass = true;
|
|
bool hidePass = true;
|
|
|
return SizedBox(
|
|
return SizedBox(
|
|
@@ -257,7 +266,7 @@ Widget loadingTemplate(VoidCallback setState){
|
|
|
setState();
|
|
setState();
|
|
|
});
|
|
});
|
|
|
return Center(
|
|
return Center(
|
|
|
- child: Container(
|
|
|
|
|
|
|
+ child: SizedBox(
|
|
|
height: 36,
|
|
height: 36,
|
|
|
child: LoadingIndicator(
|
|
child: LoadingIndicator(
|
|
|
indicatorType: Indicator.ballPulseRise,
|
|
indicatorType: Indicator.ballPulseRise,
|
|
@@ -272,7 +281,7 @@ Widget loadingTemplate(VoidCallback setState){
|
|
|
|
|
|
|
|
Widget loadingTemplateNoVoid(){
|
|
Widget loadingTemplateNoVoid(){
|
|
|
return Center(
|
|
return Center(
|
|
|
- child: Container(
|
|
|
|
|
|
|
+ child: SizedBox(
|
|
|
height: 36,
|
|
height: 36,
|
|
|
child: LoadingIndicator(
|
|
child: LoadingIndicator(
|
|
|
indicatorType: Indicator.ballPulseRise,
|
|
indicatorType: Indicator.ballPulseRise,
|
|
@@ -325,22 +334,22 @@ Widget infoContainer(String text){
|
|
|
return Container(
|
|
return Container(
|
|
|
width: double.infinity,
|
|
width: double.infinity,
|
|
|
padding: EdgeInsets.all(12),
|
|
padding: EdgeInsets.all(12),
|
|
|
- child: Text(text, style: TextStyle(color: textColor), textAlign: TextAlign.center),
|
|
|
|
|
decoration: BoxDecoration(
|
|
decoration: BoxDecoration(
|
|
|
color: secondaryColor.withValues(alpha: 0.1),
|
|
color: secondaryColor.withValues(alpha: 0.1),
|
|
|
border: Border.all(color: secondaryColor),
|
|
border: Border.all(color: secondaryColor),
|
|
|
borderRadius: BorderRadius.all(Radius.circular(12))
|
|
borderRadius: BorderRadius.all(Radius.circular(12))
|
|
|
),
|
|
),
|
|
|
|
|
+ child: Text(text, style: TextStyle(color: textColor), textAlign: TextAlign.center),
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class PhotoPreview extends StatelessWidget {
|
|
class PhotoPreview extends StatelessWidget {
|
|
|
- final title;
|
|
|
|
|
|
|
+ final String title;
|
|
|
final imageUrl;
|
|
final imageUrl;
|
|
|
final bool isUrl;
|
|
final bool isUrl;
|
|
|
final bool isNetwork;
|
|
final bool isNetwork;
|
|
|
|
|
|
|
|
- PhotoPreview(this.title, this.imageUrl, this.isUrl, {this.isNetwork = false});
|
|
|
|
|
|
|
+ const PhotoPreview(this.title, this.imageUrl, this.isUrl, {super.key, this.isNetwork = false});
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
@@ -357,7 +366,7 @@ class PhotoPreview extends StatelessWidget {
|
|
|
onTap: () => Navigator.of(context).pop(),
|
|
onTap: () => Navigator.of(context).pop(),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
- body: Container(
|
|
|
|
|
|
|
+ body: SizedBox(
|
|
|
width: MediaQuery.of(context).size.width,
|
|
width: MediaQuery.of(context).size.width,
|
|
|
height: MediaQuery.of(context).size.height,
|
|
height: MediaQuery.of(context).size.height,
|
|
|
child: PhotoView(
|
|
child: PhotoView(
|
|
@@ -385,12 +394,12 @@ class PhotoPreviewGallery extends StatelessWidget {
|
|
|
title: Text(title, style: TextStyle(fontSize: 18)),
|
|
title: Text(title, style: TextStyle(fontSize: 18)),
|
|
|
backgroundColor: Colors.black.withValues(alpha: 0.4),
|
|
backgroundColor: Colors.black.withValues(alpha: 0.4),
|
|
|
titleSpacing: 0,
|
|
titleSpacing: 0,
|
|
|
- leading: new IconButton(
|
|
|
|
|
- icon: new Icon(Icons.arrow_back_rounded),
|
|
|
|
|
|
|
+ leading: IconButton(
|
|
|
|
|
+ icon: Icon(Icons.arrow_back_rounded),
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
),
|
|
),
|
|
|
),
|
|
),
|
|
|
- body: Container(
|
|
|
|
|
|
|
+ body: SizedBox(
|
|
|
width: MediaQuery.of(context).size.width,
|
|
width: MediaQuery.of(context).size.width,
|
|
|
height: MediaQuery.of(context).size.height,
|
|
height: MediaQuery.of(context).size.height,
|
|
|
child: PhotoViewGallery.builder(
|
|
child: PhotoViewGallery.builder(
|
|
@@ -399,7 +408,7 @@ class PhotoPreviewGallery extends StatelessWidget {
|
|
|
builder: (context, index) {
|
|
builder: (context, index) {
|
|
|
var uuid = Uuid().v1().replaceAll('-', '');
|
|
var uuid = Uuid().v1().replaceAll('-', '');
|
|
|
return PhotoViewGalleryPageOptions(
|
|
return PhotoViewGalleryPageOptions(
|
|
|
- imageProvider: (isUrl?NetworkImage(imageList[index][column]+'?uuid='+uuid):imageList[index] is File?FileImage(imageList[index]):MemoryImage(imageList[index])) as ImageProvider<Object>?,
|
|
|
|
|
|
|
+ imageProvider: (isUrl ? NetworkImage('${imageList[index][column]}?uuid=$uuid') : imageList[index] is File ? FileImage(imageList[index]) : MemoryImage(imageList[index])) as ImageProvider<Object>?,
|
|
|
maxScale: 5.0, minScale: 0.3,
|
|
maxScale: 5.0, minScale: 0.3,
|
|
|
);
|
|
);
|
|
|
},
|
|
},
|
|
@@ -412,7 +421,7 @@ class PhotoPreviewGallery extends StatelessWidget {
|
|
|
//------------------------------------------------------------------------------
|
|
//------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class MyClipper extends CustomClipper<Path> {
|
|
class MyClipper extends CustomClipper<Path> {
|
|
|
- final isNip;
|
|
|
|
|
|
|
+ final bool isNip;
|
|
|
|
|
|
|
|
MyClipper(this.isNip);
|
|
MyClipper(this.isNip);
|
|
|
|
|
|
|
@@ -443,7 +452,7 @@ class MyClipper extends CustomClipper<Path> {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
class YourClipper extends CustomClipper<Path> {
|
|
class YourClipper extends CustomClipper<Path> {
|
|
|
- final isNip;
|
|
|
|
|
|
|
+ final bool isNip;
|
|
|
|
|
|
|
|
YourClipper(this.isNip);
|
|
YourClipper(this.isNip);
|
|
|
|
|
|
|
@@ -524,7 +533,7 @@ void showError(BuildContext context, message) {
|
|
|
flushbarPosition: FlushbarPosition.BOTTOM,
|
|
flushbarPosition: FlushbarPosition.BOTTOM,
|
|
|
margin: EdgeInsets.all(8),
|
|
margin: EdgeInsets.all(8),
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
|
|
- )..show(context);
|
|
|
|
|
|
|
+ ).show(context);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void showSuccess(context, message) {
|
|
void showSuccess(context, message) {
|
|
@@ -539,7 +548,7 @@ void showSuccess(context, message) {
|
|
|
flushbarPosition: FlushbarPosition.BOTTOM,
|
|
flushbarPosition: FlushbarPosition.BOTTOM,
|
|
|
margin: EdgeInsets.all(8),
|
|
margin: EdgeInsets.all(8),
|
|
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
|
borderRadius: BorderRadius.all(Radius.circular(8)),
|
|
|
- )..show(context);
|
|
|
|
|
|
|
+ ).show(context);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
String convertDate(date, String locale) {
|
|
String convertDate(date, String locale) {
|
|
@@ -554,9 +563,9 @@ String convertDate(date, String locale) {
|
|
|
|
|
|
|
|
final aDate = DateTime(dateToCheck.year, dateToCheck.month, dateToCheck.day);
|
|
final aDate = DateTime(dateToCheck.year, dateToCheck.month, dateToCheck.day);
|
|
|
if (aDate == today) {
|
|
if (aDate == today) {
|
|
|
- return 'today'.tr()+' '+DateFormat('HH:mm', locale).format(DateTime.parse(date));
|
|
|
|
|
|
|
+ return '${'today'.tr()} ${DateFormat('HH:mm', locale).format(DateTime.parse(date))}';
|
|
|
} else if (aDate == yesterday) {
|
|
} else if (aDate == yesterday) {
|
|
|
- return 'yesterday'.tr()+' '+DateFormat('HH:mm', locale).format(DateTime.parse(date));
|
|
|
|
|
|
|
+ return '${'yesterday'.tr()} ${DateFormat('HH:mm', locale).format(DateTime.parse(date))}';
|
|
|
} else {
|
|
} else {
|
|
|
return DateFormat('dd MMM HH:mm', locale).format(DateTime.parse(date));
|
|
return DateFormat('dd MMM HH:mm', locale).format(DateTime.parse(date));
|
|
|
}
|
|
}
|
|
@@ -567,7 +576,7 @@ String convertDate(date, String locale) {
|
|
|
class RefreshPage extends StatelessWidget {
|
|
class RefreshPage extends StatelessWidget {
|
|
|
final VoidCallback onRefresh;
|
|
final VoidCallback onRefresh;
|
|
|
|
|
|
|
|
- RefreshPage(this.onRefresh);
|
|
|
|
|
|
|
+ const RefreshPage(this.onRefresh, {super.key});
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
@@ -594,6 +603,8 @@ final JwtToken token = JwtToken();
|
|
|
final SharedPreferencesManager _sharedPreferencesManager = locator<SharedPreferencesManager>();
|
|
final SharedPreferencesManager _sharedPreferencesManager = locator<SharedPreferencesManager>();
|
|
|
|
|
|
|
|
class NoDataPage extends StatelessWidget {
|
|
class NoDataPage extends StatelessWidget {
|
|
|
|
|
+ const NoDataPage({super.key});
|
|
|
|
|
+
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
|
return Center(
|
|
return Center(
|
|
@@ -672,7 +683,7 @@ handlingError(context, type) {
|
|
|
width: 200,
|
|
width: 200,
|
|
|
padding: const EdgeInsets.fromLTRB(15, 0, 15, 10),
|
|
padding: const EdgeInsets.fromLTRB(15, 0, 15, 10),
|
|
|
child: Image(
|
|
child: Image(
|
|
|
- image: AssetImage('assets/image/error/' + data[type]['image']!))),
|
|
|
|
|
|
|
+ image: AssetImage('assets/image/error/${data[type]['image']!}'))),
|
|
|
Padding(
|
|
Padding(
|
|
|
padding: const EdgeInsets.fromLTRB(15, 0, 15, 10),
|
|
padding: const EdgeInsets.fromLTRB(15, 0, 15, 10),
|
|
|
child: Text(data[type]['title']!,
|
|
child: Text(data[type]['title']!,
|
|
@@ -700,7 +711,7 @@ handlingError(context, type) {
|
|
|
RoundedRectangleBorder(
|
|
RoundedRectangleBorder(
|
|
|
borderRadius: BorderRadius.circular(5),
|
|
borderRadius: BorderRadius.circular(5),
|
|
|
))),
|
|
))),
|
|
|
- child: new Text('logout'.tr().toUpperCase(),
|
|
|
|
|
|
|
+ child: Text('logout'.tr().toUpperCase(),
|
|
|
style: TextStyle(color: Colors.white),
|
|
style: TextStyle(color: Colors.white),
|
|
|
textAlign: TextAlign.center),
|
|
textAlign: TextAlign.center),
|
|
|
onPressed: () {
|
|
onPressed: () {
|
|
@@ -739,7 +750,7 @@ handlingError(context, type) {
|
|
|
},
|
|
},
|
|
|
)),
|
|
)),
|
|
|
)
|
|
)
|
|
|
- : Container(height: 1, width: 1)
|
|
|
|
|
|
|
+ : SizedBox(height: 1, width: 1)
|
|
|
],
|
|
],
|
|
|
),
|
|
),
|
|
|
);
|
|
);
|
|
@@ -754,7 +765,7 @@ class NoImageFound extends StatelessWidget {
|
|
|
|
|
|
|
|
@override
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
Widget build(BuildContext context) {
|
|
|
- return Container(
|
|
|
|
|
|
|
+ return SizedBox(
|
|
|
width: MediaQuery.of(context).size.width - 150,
|
|
width: MediaQuery.of(context).size.width - 150,
|
|
|
height: MediaQuery.of(context).size.height / 4,
|
|
height: MediaQuery.of(context).size.height / 4,
|
|
|
child: Stack(
|
|
child: Stack(
|
|
@@ -771,12 +782,12 @@ class NoImageFound extends StatelessWidget {
|
|
|
child: show
|
|
child: show
|
|
|
? Container(
|
|
? Container(
|
|
|
padding: const EdgeInsets.all(10),
|
|
padding: const EdgeInsets.all(10),
|
|
|
- child: Text('notFoundImg'.tr(),
|
|
|
|
|
- style: TextStyle(fontSize: 12)),
|
|
|
|
|
decoration: BoxDecoration(
|
|
decoration: BoxDecoration(
|
|
|
color: Colors.white24,
|
|
color: Colors.white24,
|
|
|
borderRadius:
|
|
borderRadius:
|
|
|
BorderRadius.all(Radius.circular(50))),
|
|
BorderRadius.all(Radius.circular(50))),
|
|
|
|
|
+ child: Text('notFoundImg'.tr(),
|
|
|
|
|
+ style: TextStyle(fontSize: 12)),
|
|
|
)
|
|
)
|
|
|
: Center(
|
|
: Center(
|
|
|
child: CircularProgressIndicator(),
|
|
child: CircularProgressIndicator(),
|