2025-03-06 17:59:15 +06:30
|
|
|
// ignore_for_file: deprecated_member_use
|
|
|
|
|
|
|
|
|
|
import 'package:fcs/domain/entities/user.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/helpers/theme.dart';
|
|
|
|
|
import 'package:fcs/localization/app_translations.dart';
|
|
|
|
|
import 'package:fcs/pages/main/model/language_model.dart';
|
|
|
|
|
import 'package:fcs/pages/widgets/local_text.dart';
|
2025-03-21 18:19:52 +06:30
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-05-29 07:45:27 +06:30
|
|
|
import 'package:flutter/material.dart';
|
2025-03-21 18:19:52 +06:30
|
|
|
import 'package:flutter_vector_icons/flutter_vector_icons.dart';
|
2020-05-29 07:45:27 +06:30
|
|
|
import 'package:logging/logging.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
2025-03-21 18:19:52 +06:30
|
|
|
import '../customer/customer_detail.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import '../widgets/label_widgets.dart';
|
2020-05-29 07:45:27 +06:30
|
|
|
|
|
|
|
|
final log = Logger('Util');
|
|
|
|
|
|
2020-09-12 03:34:52 +06:30
|
|
|
Future showMsgDialog(BuildContext context, String title, String msg) {
|
|
|
|
|
return showDialog(
|
2020-05-29 07:45:27 +06:30
|
|
|
context: context,
|
|
|
|
|
builder: (_) {
|
|
|
|
|
return AlertDialog(
|
2025-03-06 17:59:15 +06:30
|
|
|
title: Text(title),
|
|
|
|
|
content: Text(msg),
|
2020-05-29 07:45:27 +06:30
|
|
|
actions: <Widget>[
|
2025-03-06 17:59:15 +06:30
|
|
|
TextButton(
|
|
|
|
|
child: Text(
|
2024-01-25 17:40:35 +06:30
|
|
|
"Close",
|
|
|
|
|
style: TextStyle(color: primaryColor),
|
|
|
|
|
),
|
2020-05-29 07:45:27 +06:30
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> showConfirmDialog(
|
|
|
|
|
BuildContext context, String translationKey, ok(),
|
2021-09-10 12:00:08 +06:30
|
|
|
{List<String>? translationVariables}) async {
|
2020-05-29 07:45:27 +06:30
|
|
|
await showDialog(
|
|
|
|
|
context: context,
|
|
|
|
|
builder: (_) {
|
|
|
|
|
return AlertDialog(
|
|
|
|
|
title: Center(
|
|
|
|
|
child: LocalText(
|
|
|
|
|
context,
|
|
|
|
|
translationKey,
|
2021-09-13 09:52:36 +06:30
|
|
|
translationVariables: translationVariables,
|
2020-09-18 21:33:41 +06:30
|
|
|
color: primaryColor,
|
2020-05-29 07:45:27 +06:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
content: Container(
|
|
|
|
|
child: Row(
|
2020-09-15 07:13:41 +06:30
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
2020-05-29 07:45:27 +06:30
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
|
children: <Widget>[
|
2024-01-09 13:11:22 +06:30
|
|
|
TextButton(
|
2024-01-25 17:40:35 +06:30
|
|
|
style: TextButton.styleFrom(
|
|
|
|
|
backgroundColor: Colors.grey[300],
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(5.0))),
|
2020-05-29 07:45:27 +06:30
|
|
|
child: Text(
|
2021-09-10 14:25:37 +06:30
|
|
|
AppTranslations.of(context)!.text('btn.cancel'),
|
2020-05-29 07:45:27 +06:30
|
|
|
style: Provider.of<LanguageModel>(context).isEng
|
2024-01-25 17:40:35 +06:30
|
|
|
? TextStyle(color: primaryColor)
|
|
|
|
|
: TextStyle(
|
|
|
|
|
fontFamily: 'Myanmar3', color: primaryColor),
|
2020-05-29 07:45:27 +06:30
|
|
|
),
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
}),
|
2020-09-15 07:13:41 +06:30
|
|
|
SizedBox(
|
|
|
|
|
width: 0,
|
|
|
|
|
),
|
2024-01-09 13:11:22 +06:30
|
|
|
TextButton(
|
2024-01-25 17:40:35 +06:30
|
|
|
style: TextButton.styleFrom(
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.circular(5.0))),
|
2021-09-10 14:25:37 +06:30
|
|
|
child: Text(AppTranslations.of(context)!.text('btn.ok'),
|
2020-05-29 07:45:27 +06:30
|
|
|
style: Provider.of<LanguageModel>(context).isEng
|
|
|
|
|
? TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold)
|
|
|
|
|
: TextStyle(
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
2020-10-07 02:33:06 +06:30
|
|
|
fontFamily: 'Myanmar3')),
|
2020-05-29 07:45:27 +06:30
|
|
|
onPressed: () async {
|
|
|
|
|
Navigator.of(context).pop();
|
|
|
|
|
await ok();
|
|
|
|
|
})
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget getStatus(String status) {
|
2020-05-29 16:14:17 +06:30
|
|
|
return status == "Delivered"
|
2020-06-01 14:24:45 +06:30
|
|
|
? Text(status,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor, fontSize: 18, fontWeight: FontWeight.bold))
|
2020-05-29 07:45:27 +06:30
|
|
|
: status == "rejected"
|
|
|
|
|
? Chip(
|
|
|
|
|
backgroundColor: Colors.red,
|
|
|
|
|
avatar: Icon(
|
|
|
|
|
Icons.remove,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
size: 14,
|
|
|
|
|
),
|
|
|
|
|
label: Text(
|
|
|
|
|
status,
|
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: 12),
|
|
|
|
|
))
|
2020-05-29 16:14:17 +06:30
|
|
|
: status == "In progress"
|
2020-06-01 14:24:45 +06:30
|
|
|
? Text(
|
|
|
|
|
status,
|
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: 12),
|
|
|
|
|
)
|
2020-05-31 15:00:11 +06:30
|
|
|
: status == "Pickuped"
|
2020-05-29 15:54:26 +06:30
|
|
|
? Text(
|
|
|
|
|
status,
|
2020-05-31 15:00:11 +06:30
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
2020-05-29 15:54:26 +06:30
|
|
|
)
|
2020-05-31 15:00:11 +06:30
|
|
|
: status == "Pending" || status == "Rescheduled"
|
|
|
|
|
? Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Icon(Icons.schedule),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
status,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
)
|
|
|
|
|
],
|
2020-05-29 15:54:26 +06:30
|
|
|
)
|
2020-05-31 15:00:11 +06:30
|
|
|
: status == "Assigned"
|
|
|
|
|
? Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.all(8.0),
|
|
|
|
|
child: Icon(Icons.check),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
status,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: status == "Canceled"
|
|
|
|
|
? Text(
|
|
|
|
|
status,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
|
)
|
2020-06-26 16:04:40 +06:30
|
|
|
: status == "Delivered" || status == "Avaliable"
|
2020-05-31 15:00:11 +06:30
|
|
|
? Text(
|
|
|
|
|
status,
|
|
|
|
|
style: TextStyle(
|
2020-06-26 16:04:40 +06:30
|
|
|
color: Colors.green, fontSize: 18),
|
2020-05-31 15:00:11 +06:30
|
|
|
)
|
2020-06-29 16:15:25 +06:30
|
|
|
: status == "Used"
|
2020-06-26 16:04:40 +06:30
|
|
|
? Text(
|
|
|
|
|
status,
|
|
|
|
|
style: TextStyle(
|
2020-06-29 16:15:25 +06:30
|
|
|
color: Colors.red, fontSize: 18),
|
2020-06-26 16:04:40 +06:30
|
|
|
)
|
|
|
|
|
: status == "Paid"
|
|
|
|
|
? Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding:
|
|
|
|
|
const EdgeInsets.all(8.0),
|
|
|
|
|
child: Icon(Icons.check),
|
|
|
|
|
),
|
|
|
|
|
Text(
|
|
|
|
|
status,
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight:
|
|
|
|
|
FontWeight.bold),
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Text(
|
2021-09-10 12:00:08 +06:30
|
|
|
status,
|
2020-06-02 14:56:51 +06:30
|
|
|
style: TextStyle(
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
fontSize: 18,
|
|
|
|
|
fontWeight: FontWeight.bold),
|
2020-06-26 16:04:40 +06:30
|
|
|
);
|
2020-05-29 07:45:27 +06:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
call(BuildContext context, String phone) {
|
|
|
|
|
showConfirmDialog(context, "contact.phone.confim", () => launch("tel:$phone"),
|
2025-03-06 17:59:15 +06:30
|
|
|
translationVariables: [phone]);
|
2020-05-29 07:45:27 +06:30
|
|
|
}
|
|
|
|
|
|
2020-05-31 15:00:11 +06:30
|
|
|
Widget nameWidget(String name) {
|
|
|
|
|
return Center(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 10.0, top: 8),
|
|
|
|
|
child: Text(
|
|
|
|
|
name,
|
|
|
|
|
style: TextStyle(
|
2020-06-26 16:04:40 +06:30
|
|
|
color: Colors.black87, fontSize: 18, fontWeight: FontWeight.bold),
|
2020-05-31 15:00:11 +06:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget phoneWidget(BuildContext context, String phone) {
|
|
|
|
|
return Container(
|
|
|
|
|
padding: EdgeInsets.only(top: 10),
|
|
|
|
|
child: Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Icon(Icons.phone),
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 8.0),
|
|
|
|
|
child: labeledText(context, phone, "user.phone"),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget fcsInput(String label, IconData iconData,
|
2021-09-10 12:00:08 +06:30
|
|
|
{required TextEditingController controller,
|
|
|
|
|
required String value,
|
2020-09-13 21:49:39 +06:30
|
|
|
bool autoFocus = false,
|
2021-09-10 12:00:08 +06:30
|
|
|
TextInputType? textInputType}) {
|
2020-06-02 14:56:51 +06:30
|
|
|
return TextFormField(
|
|
|
|
|
initialValue: value,
|
|
|
|
|
controller: controller,
|
|
|
|
|
cursorColor: primaryColor,
|
|
|
|
|
maxLines: null,
|
|
|
|
|
minLines: 1,
|
2020-09-13 21:49:39 +06:30
|
|
|
autofocus: autoFocus,
|
|
|
|
|
keyboardType: textInputType,
|
2020-06-02 14:56:51 +06:30
|
|
|
decoration: InputDecoration(
|
|
|
|
|
fillColor: Colors.white,
|
|
|
|
|
labelText: label,
|
|
|
|
|
labelStyle: TextStyle(fontSize: 16, color: Colors.grey),
|
|
|
|
|
filled: true,
|
|
|
|
|
icon: Icon(
|
|
|
|
|
iconData,
|
2020-06-03 00:42:31 +06:30
|
|
|
color: primaryColor,
|
2020-06-02 14:56:51 +06:30
|
|
|
),
|
|
|
|
|
focusedBorder: UnderlineInputBorder(
|
|
|
|
|
borderSide: BorderSide(color: Colors.grey, width: 1.0)),
|
|
|
|
|
));
|
2020-05-31 15:00:11 +06:30
|
|
|
}
|
|
|
|
|
|
2020-06-01 14:42:42 +06:30
|
|
|
Widget fcsInputReadOnly(String label, IconData iconData,
|
2021-09-10 12:00:08 +06:30
|
|
|
{required TextEditingController controller, required String value}) {
|
2020-06-02 14:56:51 +06:30
|
|
|
return TextFormField(
|
|
|
|
|
initialValue: value,
|
|
|
|
|
controller: controller,
|
|
|
|
|
cursorColor: primaryColor,
|
|
|
|
|
maxLines: null,
|
|
|
|
|
minLines: 1,
|
2020-06-29 16:15:25 +06:30
|
|
|
readOnly: true,
|
2020-06-02 14:56:51 +06:30
|
|
|
decoration: InputDecoration(
|
|
|
|
|
fillColor: Colors.white,
|
|
|
|
|
border: InputBorder.none,
|
|
|
|
|
labelText: label,
|
|
|
|
|
labelStyle: TextStyle(fontSize: 16, color: Colors.grey),
|
|
|
|
|
filled: true,
|
|
|
|
|
icon: Icon(
|
|
|
|
|
iconData,
|
2020-08-30 21:26:37 +06:30
|
|
|
color: primaryColor,
|
2020-06-02 14:56:51 +06:30
|
|
|
),
|
|
|
|
|
));
|
2020-06-01 14:42:42 +06:30
|
|
|
}
|
|
|
|
|
|
2020-05-31 15:00:11 +06:30
|
|
|
Widget fcsDropDown(String label, IconData iconData,
|
2021-09-10 12:00:08 +06:30
|
|
|
{required TextEditingController controller}) {
|
2020-05-31 15:00:11 +06:30
|
|
|
return Row(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 8.0),
|
|
|
|
|
child: Icon(iconData),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
2025-03-06 17:59:15 +06:30
|
|
|
child: SizedBox(
|
2020-05-31 15:00:11 +06:30
|
|
|
height: 50.0,
|
|
|
|
|
child: Row(children: <Widget>[
|
|
|
|
|
Expanded(child: _dropDown()),
|
|
|
|
|
]),
|
|
|
|
|
)),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _dropDown() {
|
|
|
|
|
return DropdownButton<String>(
|
|
|
|
|
value: "Ko Nge",
|
|
|
|
|
icon: Icon(Icons.arrow_downward),
|
|
|
|
|
iconSize: 24,
|
|
|
|
|
elevation: 16,
|
|
|
|
|
// style: TextStyle(color: Colors.deepPurple),
|
|
|
|
|
underline: Container(
|
|
|
|
|
height: 2,
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
),
|
2021-09-10 12:00:08 +06:30
|
|
|
onChanged: (String? newValue) {},
|
2020-05-31 15:00:11 +06:30
|
|
|
items: <String>['Ko Nge', 'Two', 'Free', 'Four']
|
|
|
|
|
.map<DropdownMenuItem<String>>((String value) {
|
|
|
|
|
return DropdownMenuItem<String>(
|
|
|
|
|
value: value,
|
|
|
|
|
child: Text(value),
|
|
|
|
|
);
|
|
|
|
|
}).toList(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-13 21:49:39 +06:30
|
|
|
Widget fcsButton(BuildContext context, String text,
|
2021-09-10 12:00:08 +06:30
|
|
|
{Function? callack, IconData? iconData}) {
|
2020-09-13 21:49:39 +06:30
|
|
|
var languageModel = Provider.of<LanguageModel>(context);
|
|
|
|
|
|
|
|
|
|
var style = languageModel.isEng
|
|
|
|
|
? TextStyle(
|
|
|
|
|
fontSize: 16.0, color: Colors.white, fontWeight: FontWeight.bold)
|
|
|
|
|
: TextStyle(
|
|
|
|
|
fontSize: 16.0,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
fontFamily: "Myanmar3");
|
|
|
|
|
|
2020-05-31 15:00:11 +06:30
|
|
|
return Container(
|
|
|
|
|
padding: EdgeInsets.only(left: 10, right: 10, top: 10),
|
2024-01-26 16:56:20 +06:30
|
|
|
child: SizedBox(
|
2020-05-31 15:00:11 +06:30
|
|
|
height: 45.0,
|
2024-01-26 16:56:20 +06:30
|
|
|
child: ElevatedButton(
|
|
|
|
|
style: ElevatedButton.styleFrom(
|
|
|
|
|
elevation: 0,
|
|
|
|
|
backgroundColor: primaryColor,
|
|
|
|
|
shape: RoundedRectangleBorder(
|
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(3)))),
|
|
|
|
|
onPressed: callack == null ? null : () => callack(),
|
|
|
|
|
child: Row(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
iconData == null
|
|
|
|
|
? Container()
|
|
|
|
|
: Icon(
|
|
|
|
|
iconData,
|
|
|
|
|
color: Colors.white,
|
|
|
|
|
),
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 15,
|
|
|
|
|
),
|
|
|
|
|
Text(text, style: style),
|
|
|
|
|
],
|
2020-05-31 15:00:11 +06:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
2020-09-07 16:05:28 +06:30
|
|
|
|
2020-09-10 02:13:22 +06:30
|
|
|
String getLocalString(BuildContext context, String key) {
|
2021-09-10 14:25:37 +06:30
|
|
|
return AppTranslations.of(context)!.text(key);
|
2020-09-10 02:13:22 +06:30
|
|
|
}
|
2020-09-20 05:34:49 +06:30
|
|
|
|
|
|
|
|
void showToast(GlobalKey key, String text) {
|
2024-01-25 17:40:35 +06:30
|
|
|
final ScaffoldMessengerState scaffold =
|
|
|
|
|
key.currentState as ScaffoldMessengerState;
|
2020-09-20 05:34:49 +06:30
|
|
|
scaffold.showSnackBar(
|
|
|
|
|
SnackBar(
|
|
|
|
|
content: Text(text),
|
|
|
|
|
backgroundColor: secondaryColor,
|
|
|
|
|
duration: Duration(seconds: 1),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool hasUnicode(String text) {
|
|
|
|
|
final int maxBits = 128;
|
|
|
|
|
List<int> unicodeSymbols =
|
|
|
|
|
text.codeUnits.where((ch) => ch > maxBits).toList();
|
2025-03-06 17:59:15 +06:30
|
|
|
return unicodeSymbols.isNotEmpty;
|
2020-09-20 05:34:49 +06:30
|
|
|
}
|
2024-02-06 17:45:36 +06:30
|
|
|
|
|
|
|
|
String removeTrailingZeros(double number) {
|
|
|
|
|
String result = number.toString();
|
|
|
|
|
result = result.indexOf('.') > 0
|
|
|
|
|
? result.replaceAll(RegExp(r"([.]*0)(?!.*\d)"), "")
|
|
|
|
|
: result;
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2025-01-14 17:10:10 +06:30
|
|
|
|
|
|
|
|
bool isValidEmail(String email) {
|
|
|
|
|
// Define a regular expression for validating an email
|
|
|
|
|
final emailRegex = RegExp(r'^[^@\s]+@[^@\s]+\.[^@\s]+$');
|
|
|
|
|
|
|
|
|
|
// Check if the email matches the pattern
|
|
|
|
|
return emailRegex.hasMatch(email);
|
2025-02-10 11:23:38 +06:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String capitalizeFirstLetter(String text) {
|
|
|
|
|
if (text.isEmpty) return text;
|
|
|
|
|
return text[0].toUpperCase() + text.substring(1);
|
|
|
|
|
}
|
2025-03-06 17:59:15 +06:30
|
|
|
|
|
|
|
|
Widget userSearchBox(BuildContext context,
|
|
|
|
|
{required String lableKey,
|
|
|
|
|
IconData? icon,
|
|
|
|
|
User? user,
|
|
|
|
|
Function()? onSearch,
|
|
|
|
|
MainAxisAlignment rowMainAxisAlignment = MainAxisAlignment.start}) {
|
|
|
|
|
return Column(
|
|
|
|
|
children: [
|
|
|
|
|
Row(
|
|
|
|
|
mainAxisAlignment: rowMainAxisAlignment,
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Flexible(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.only(left: 2),
|
|
|
|
|
child:
|
|
|
|
|
LocalText(context, lableKey, color: labelColor, fontSize: 15),
|
|
|
|
|
)),
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(Icons.search, color: Colors.black),
|
|
|
|
|
onPressed: onSearch),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Padding(
|
|
|
|
|
padding: const EdgeInsets.only(
|
|
|
|
|
right: 15,
|
|
|
|
|
),
|
|
|
|
|
child: user != null && user.fcsID != ""
|
|
|
|
|
? Icon(icon, color: primaryColor)
|
|
|
|
|
: const SizedBox(),
|
|
|
|
|
),
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Text(user?.name ?? ''),
|
|
|
|
|
Text(user?.fcsID ?? '',
|
|
|
|
|
style: TextStyle(fontSize: 13, color: labelColor)),
|
|
|
|
|
Text(user?.phoneNumber ?? '',
|
|
|
|
|
style: TextStyle(fontSize: 13, color: labelColor))
|
|
|
|
|
],
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget userDisplayBox(BuildContext context,
|
2025-03-07 17:41:09 +06:30
|
|
|
{required String lableKey,
|
|
|
|
|
IconData? icon,
|
|
|
|
|
String? name,
|
|
|
|
|
String? fcsID,
|
|
|
|
|
bool showLink = true}) {
|
2025-03-06 17:59:15 +06:30
|
|
|
return fcsID != null && fcsID != ""
|
|
|
|
|
? Padding(
|
|
|
|
|
padding: const EdgeInsets.only(top: 8.0, bottom: 8),
|
|
|
|
|
child: Row(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
2025-03-07 17:41:09 +06:30
|
|
|
icon != null
|
|
|
|
|
? Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 15),
|
|
|
|
|
child: Icon(icon, color: primaryColor))
|
|
|
|
|
: const SizedBox(),
|
2025-03-06 17:59:15 +06:30
|
|
|
Expanded(
|
|
|
|
|
child: Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocalText(context, lableKey,
|
|
|
|
|
color: Colors.black54, fontSize: 15),
|
|
|
|
|
InkWell(
|
2025-03-21 18:19:52 +06:30
|
|
|
onTap: showLink
|
|
|
|
|
? () {
|
|
|
|
|
Navigator.push(
|
|
|
|
|
context,
|
|
|
|
|
CupertinoPageRoute(
|
|
|
|
|
builder: (context) =>
|
|
|
|
|
CustomerDetail(fcsId: fcsID)));
|
|
|
|
|
}
|
|
|
|
|
: null,
|
2025-03-07 17:41:09 +06:30
|
|
|
child: Text(name ?? '',
|
|
|
|
|
style: showLink
|
|
|
|
|
? TextStyle(
|
|
|
|
|
shadows: [
|
|
|
|
|
Shadow(
|
|
|
|
|
color: linkColor,
|
|
|
|
|
offset: Offset(0, -2))
|
|
|
|
|
],
|
|
|
|
|
color: Colors.transparent,
|
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
|
decorationColor: linkColor)
|
|
|
|
|
: TextStyle(color: Colors.black)),
|
2025-03-06 17:59:15 +06:30
|
|
|
),
|
|
|
|
|
Text(fcsID,
|
|
|
|
|
style: TextStyle(fontSize: 13, color: labelColor))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: const SizedBox();
|
|
|
|
|
}
|
2025-03-21 18:19:52 +06:30
|
|
|
|
|
|
|
|
Widget settingRow(BuildContext context,
|
|
|
|
|
{required String label,
|
|
|
|
|
IconData? iconData,
|
|
|
|
|
Widget? image,
|
|
|
|
|
Function()? onTap,
|
|
|
|
|
String? text}) {
|
|
|
|
|
return ListTile(
|
|
|
|
|
minTileHeight: 50,
|
|
|
|
|
contentPadding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
|
|
|
|
onTap: onTap,
|
|
|
|
|
leading: iconData != null
|
|
|
|
|
? Icon(iconData, color: primaryColor)
|
|
|
|
|
: image ?? const SizedBox(),
|
|
|
|
|
title: LocalText(context, label, fontSize: 15, color: Colors.black54),
|
|
|
|
|
subtitle: text != null
|
|
|
|
|
? Padding(
|
|
|
|
|
padding: const EdgeInsets.only(right: 10),
|
|
|
|
|
child: Text(
|
|
|
|
|
text,
|
|
|
|
|
style: const TextStyle(color: Colors.black),
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
: const SizedBox(),
|
|
|
|
|
trailing: Row(
|
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
|
children: [
|
|
|
|
|
const Icon(SimpleLineIcons.arrow_right, color: labelColor, size: 16),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|