adding i18n to all other pages batch3
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../../providers/token_manager.dart';
|
||||
import 'dynamic_form_service.dart';
|
||||
|
||||
@@ -49,7 +50,7 @@ class _EditFormState extends State<EditForm> {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('Edit Form'),
|
||||
title: Text(AppLocalizations.of(context)!.editForm),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
@@ -58,16 +59,21 @@ class _EditFormState extends State<EditForm> {
|
||||
children: [
|
||||
TextFormField(
|
||||
controller: formNameController,
|
||||
decoration: InputDecoration(labelText: 'Form Name'),
|
||||
decoration: InputDecoration(
|
||||
labelText:
|
||||
AppLocalizations.of(context)!.formName),
|
||||
),
|
||||
TextFormField(
|
||||
controller: formDescController,
|
||||
decoration: InputDecoration(labelText: 'Form Description'),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!
|
||||
.formDescription),
|
||||
),
|
||||
DropdownButtonFormField<String>(
|
||||
value: relatedToController.text,
|
||||
decoration:
|
||||
const InputDecoration(labelText: 'Select Related To'),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!
|
||||
.selectRelatedTo),
|
||||
items: [
|
||||
...relatedToFixedDropdown.map<DropdownMenuItem<String>>(
|
||||
(item) {
|
||||
@@ -86,8 +92,9 @@ class _EditFormState extends State<EditForm> {
|
||||
),
|
||||
DropdownButtonFormField<String>(
|
||||
value: pageEventController.text,
|
||||
decoration:
|
||||
const InputDecoration(labelText: 'Select Page Event'),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!
|
||||
.selectPageEvent),
|
||||
items: [
|
||||
...pageEventFixedDropdown.map<DropdownMenuItem<String>>(
|
||||
(item) {
|
||||
@@ -106,22 +113,41 @@ class _EditFormState extends State<EditForm> {
|
||||
),
|
||||
TextFormField(
|
||||
controller: buttonCaptionController,
|
||||
decoration: InputDecoration(labelText: 'Button Caption'),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!
|
||||
.buttonCaption),
|
||||
),
|
||||
|
||||
const Text('Components Details'),
|
||||
Text(AppLocalizations.of(context)!.componentsDetails),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: DataTable(
|
||||
columns: const <DataColumn>[
|
||||
DataColumn(label: Text('Label')),
|
||||
DataColumn(label: Text('Type')),
|
||||
DataColumn(label: Text('Mapping')),
|
||||
DataColumn(label: Text('Mandatory')),
|
||||
DataColumn(label: Text('Readonly')),
|
||||
DataColumn(label: Text('Drop Values')),
|
||||
DataColumn(label: Text('SP')),
|
||||
DataColumn(label: Text('Actions'), numeric: false), // Add Actions column
|
||||
columns: <DataColumn>[
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colLabel)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colType)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colMapping)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colMandatory)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colReadonly)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colDropValues)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colSP)),
|
||||
DataColumn(
|
||||
label: Text(AppLocalizations.of(context)!
|
||||
.colActions),
|
||||
numeric: false), // Add Actions column
|
||||
],
|
||||
rows: components.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
@@ -228,7 +254,8 @@ class _EditFormState extends State<EditForm> {
|
||||
components.removeAt(index);
|
||||
});
|
||||
},
|
||||
child: Text('Delete'),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.delete),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -250,7 +277,7 @@ class _EditFormState extends State<EditForm> {
|
||||
});
|
||||
setState(() {}); // Refresh the UI to show the new row
|
||||
},
|
||||
child: Text('Add Row'),
|
||||
child: Text(AppLocalizations.of(context)!.addRow),
|
||||
),
|
||||
|
||||
ElevatedButton(
|
||||
@@ -266,7 +293,7 @@ class _EditFormState extends State<EditForm> {
|
||||
apiService.updateDynamicForm(token!, widget.formData['form_id'], widget.formData);
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Text('Update'),
|
||||
child: Text(AppLocalizations.of(context)!.update),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import '../../Utils/image_constant.dart';
|
||||
import '../../Utils/size_utils.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../../providers/token_manager.dart';
|
||||
import '../../theme/app_style.dart';
|
||||
import '../../widgets/app_bar/appbar_image.dart';
|
||||
@@ -51,7 +52,9 @@ class _CreateFormState extends State<CreateForm> {
|
||||
Navigator.pop(context);
|
||||
}),
|
||||
centerTitle: true,
|
||||
title: AppbarTitle(text: "Create Dynamic Form"),),
|
||||
title: AppbarTitle(
|
||||
text: AppLocalizations.of(context)!
|
||||
.createDynamicForm),),
|
||||
body: SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
@@ -63,14 +66,15 @@ class _CreateFormState extends State<CreateForm> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("Form Name",
|
||||
Text(AppLocalizations.of(context)!.formName,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppStyle
|
||||
.txtGilroyMedium16Bluegray900),
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
hintText: "Enter Form Name",
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.enterFormName,
|
||||
controller: formNameController,
|
||||
margin: getMargin(top: 6))
|
||||
])),
|
||||
@@ -80,14 +84,17 @@ class _CreateFormState extends State<CreateForm> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("Form Description",
|
||||
Text(
|
||||
AppLocalizations.of(context)!
|
||||
.formDescription,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppStyle
|
||||
.txtGilroyMedium16Bluegray900),
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
hintText: "Enter Form Description",
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.enterFormDescription,
|
||||
controller: formDescController,
|
||||
margin: getMargin(top: 6))
|
||||
])),
|
||||
@@ -99,7 +106,7 @@ class _CreateFormState extends State<CreateForm> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Select Related To",
|
||||
AppLocalizations.of(context)!.selectRelatedTo,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppStyle.txtGilroyMedium16Bluegray900,
|
||||
@@ -132,7 +139,7 @@ class _CreateFormState extends State<CreateForm> {
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Select Page Event",
|
||||
AppLocalizations.of(context)!.selectPageEvent,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppStyle.txtGilroyMedium16Bluegray900,
|
||||
@@ -163,29 +170,46 @@ class _CreateFormState extends State<CreateForm> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text("Button Caption",
|
||||
Text(
|
||||
AppLocalizations.of(context)!
|
||||
.buttonCaption,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: TextAlign.left,
|
||||
style: AppStyle
|
||||
.txtGilroyMedium16Bluegray900),
|
||||
CustomTextFormField(
|
||||
focusNode: FocusNode(),
|
||||
hintText: "Enter Button Caption",
|
||||
hintText: AppLocalizations.of(context)!
|
||||
.enterButtonCaption,
|
||||
controller: buttonCaptionController,
|
||||
margin: getMargin(top: 6))
|
||||
])),
|
||||
const Text('Components Details'),
|
||||
Text(AppLocalizations.of(context)!.componentsDetails),
|
||||
SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: DataTable(
|
||||
columns: const <DataColumn>[
|
||||
DataColumn(label: Text('Label')),
|
||||
DataColumn(label: Text('Type')),
|
||||
DataColumn(label: Text('Mapping')),
|
||||
DataColumn(label: Text('Mandatory')),
|
||||
DataColumn(label: Text('Readonly')),
|
||||
DataColumn(label: Text('Drop Values')),
|
||||
DataColumn(label: Text('SP')),
|
||||
columns: <DataColumn>[
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colLabel)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colType)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colMapping)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colMandatory)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colReadonly)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colDropValues)),
|
||||
DataColumn(
|
||||
label: Text(
|
||||
AppLocalizations.of(context)!.colSP)),
|
||||
],
|
||||
rows: components.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
@@ -201,8 +225,9 @@ class _CreateFormState extends State<CreateForm> {
|
||||
)),
|
||||
DataCell(
|
||||
DropdownButtonFormField<String>(
|
||||
decoration:
|
||||
const InputDecoration(labelText: 'Select Type'),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!
|
||||
.selectType),
|
||||
items: [
|
||||
...typeFixedDropdown.map<DropdownMenuItem<String>>(
|
||||
(item) {
|
||||
@@ -223,8 +248,9 @@ class _CreateFormState extends State<CreateForm> {
|
||||
),
|
||||
DataCell(
|
||||
DropdownButtonFormField<String>(
|
||||
decoration:
|
||||
const InputDecoration(labelText: 'Select Mapping'),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!
|
||||
.selectMapping),
|
||||
items: [
|
||||
...mappingFixedDropdown.map<DropdownMenuItem<String>>(
|
||||
(item) {
|
||||
@@ -251,8 +277,9 @@ class _CreateFormState extends State<CreateForm> {
|
||||
)),
|
||||
DataCell(
|
||||
DropdownButtonFormField<String>(
|
||||
decoration:
|
||||
const InputDecoration(labelText: 'Select Read Only'),
|
||||
decoration: InputDecoration(
|
||||
labelText: AppLocalizations.of(context)!
|
||||
.selectReadOnly),
|
||||
items: [
|
||||
...truefalseFixedDropdown.map<DropdownMenuItem<String>>(
|
||||
(item) {
|
||||
@@ -290,7 +317,7 @@ class _CreateFormState extends State<CreateForm> {
|
||||
),
|
||||
CustomButton(
|
||||
height: getVerticalSize(50),
|
||||
text: "Add Row",
|
||||
text: AppLocalizations.of(context)!.addRow,
|
||||
margin: getMargin(top: 24, bottom: 5),
|
||||
onTap: () async {
|
||||
components.add({
|
||||
@@ -308,7 +335,7 @@ class _CreateFormState extends State<CreateForm> {
|
||||
|
||||
CustomButton(
|
||||
height: getVerticalSize(50),
|
||||
text: "Create Dynamic Form",
|
||||
text: AppLocalizations.of(context)!.createDynamicForm,
|
||||
margin: getMargin(top: 24, bottom: 5),
|
||||
onTap: () async {
|
||||
final dynamicFormData = {
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/rendering.dart';
|
||||
import '../../Utils/color_constants.dart';
|
||||
import '../../Utils/image_constant.dart';
|
||||
import '../../Utils/size_utils.dart';
|
||||
import '../../l10n/app_localizations.dart';
|
||||
import '../../providers/token_manager.dart';
|
||||
import '../../widgets/app_bar/appbar_image.dart';
|
||||
import '../../widgets/app_bar/appbar_title.dart';
|
||||
@@ -58,11 +59,12 @@ class _DynamicFormState extends State<DynamicForm> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text('Error'),
|
||||
content: Text('Failed to delete entity: $e'),
|
||||
title: Text(AppLocalizations.of(context)!.error),
|
||||
content: Text(AppLocalizations.of(context)!
|
||||
.deleteEntityFailed(e.toString())),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('OK'),
|
||||
child: Text(AppLocalizations.of(context)!.ok),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
@@ -109,12 +111,15 @@ class _DynamicFormState extends State<DynamicForm> {
|
||||
)
|
||||
],
|
||||
centerTitle: true,
|
||||
title: AppbarTitle(text: "Dynamic Form")),
|
||||
title: AppbarTitle(
|
||||
text:
|
||||
AppLocalizations.of(context)!.dynamicForm)),
|
||||
body: isLoading == false
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: allData.isEmpty
|
||||
? const Center(
|
||||
child: Text('No Services available.'),
|
||||
? Center(
|
||||
child: Text(AppLocalizations.of(context)!
|
||||
.noServices),
|
||||
)
|
||||
: Scrollable(
|
||||
viewportBuilder:
|
||||
@@ -125,13 +130,27 @@ class _DynamicFormState extends State<DynamicForm> {
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: DataTable(
|
||||
columns: [
|
||||
DataColumn(label: Text('Form Name')),
|
||||
DataColumn(label: Text('Form Description')),
|
||||
DataColumn(label: Text('Related To')),
|
||||
DataColumn(label: Text('Page Event')),
|
||||
DataColumn(label: Text('Button Caption')),
|
||||
DataColumn(label: Text('Build')),
|
||||
DataColumn(label: Text('Actions')),
|
||||
DataColumn(
|
||||
label: Text(AppLocalizations.of(context)!
|
||||
.formName)),
|
||||
DataColumn(
|
||||
label: Text(AppLocalizations.of(context)!
|
||||
.formDescription)),
|
||||
DataColumn(
|
||||
label: Text(AppLocalizations.of(context)!
|
||||
.relatedTo)),
|
||||
DataColumn(
|
||||
label: Text(AppLocalizations.of(context)!
|
||||
.pageEvent)),
|
||||
DataColumn(
|
||||
label: Text(AppLocalizations.of(context)!
|
||||
.buttonCaption)),
|
||||
DataColumn(
|
||||
label: Text(AppLocalizations.of(context)!
|
||||
.buildCol)),
|
||||
DataColumn(
|
||||
label: Text(AppLocalizations.of(context)!
|
||||
.colActions)),
|
||||
],
|
||||
rows: allData.map((module) {
|
||||
return DataRow(
|
||||
@@ -156,7 +175,9 @@ class _DynamicFormState extends State<DynamicForm> {
|
||||
apiService.BuildForms(
|
||||
token!, module['form_id']);
|
||||
},
|
||||
child: Text("build"),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!
|
||||
.buildBtn),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: ColorConstant.blue700,
|
||||
),
|
||||
@@ -184,19 +205,29 @@ class _DynamicFormState extends State<DynamicForm> {
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: const Text(
|
||||
'Confirm Deletion'),
|
||||
content: const Text(
|
||||
'Are you sure you want to delete this Module?'),
|
||||
title: Text(
|
||||
AppLocalizations.of(
|
||||
context)!
|
||||
.confirmDeletion),
|
||||
content: Text(
|
||||
AppLocalizations.of(
|
||||
context)!
|
||||
.deleteModuleConfirm),
|
||||
actions: [
|
||||
TextButton(
|
||||
child: const Text('Cancel'),
|
||||
child: Text(
|
||||
AppLocalizations.of(
|
||||
context)!
|
||||
.cancel),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: const Text('Delete'),
|
||||
child: Text(
|
||||
AppLocalizations.of(
|
||||
context)!
|
||||
.delete),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
deleteEntity(module);
|
||||
|
||||
Reference in New Issue
Block a user