build_app

This commit is contained in:
risadmin_prod 2025-03-31 07:02:22 +00:00
parent e4a795fa28
commit 30ba5bd062
10 changed files with 146 additions and 269 deletions

View File

@ -55,126 +55,66 @@ final Map<String, dynamic> formData = {};
final TextEditingController nameController = TextEditingController();
late Future<List<Map<String, dynamic>>> _value_list_fielddataFuture; // Data from fetchData
late final Function(String) onPaymentSelectedcheckout_field;
Future<List<Map<String, dynamic>>> value_list_fieldfetchData() async {
final provider =
Provider.of<TestttViewModelScreen>(context, listen: false);
final resp = await provider.getEntities();
if (resp != null) {
return resp;
} else {
throw Exception('Failed to load data: ');
}
}
void showvalue_list_fieldDialog(BuildContext context) {
void _showPaymentOptionscheckout_field() {
showDialog(
context: context,
builder: (BuildContext context) {
return SingleChildScrollView(
child: AlertDialog(
title: const Text('Select a record'),
content: FutureBuilder<List<Map<String, dynamic>>>(
future: _value_list_fielddataFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
} else if (!snapshot.hasData || snapshot.data!.isEmpty) {
return const Center(child: Text('No data available..'));
} else {
final List<String> columnsToShow = [
'name',
];
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
columnSpacing: 30,
headingRowColor: MaterialStateColor.resolveWith(
(states) => Colors.blue.shade100),
dataRowColor: MaterialStateColor.resolveWith(
(states) => Colors.white),
dividerThickness: 0.5,
columns: columnsToShow
.map(
(key) => DataColumn(
label: Text(
key,
style: const TextStyle(
fontWeight: FontWeight.bold, fontSize: 16),
),
),
)
.toList(),
rows: snapshot.data!.map((item) {
return DataRow(
cells: columnsToShow.map((key) {
return DataCell(
Text(
item[key].toString(),
style: const TextStyle(fontSize: 14),
),
onTap: () {
setState(() {
nameController.text = item['name'] ?? '';
// Add more fields as needed
});
Navigator.pop(context);
},
);
}).toList());
}).toList(),
),
);
}
},
),
actions: [
TextButton(
child: const Text('Close'),
onPressed: () {
return AlertDialog(
title: Text('Select Payment Method'),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
GestureDetector(
onTap: () {
onPaymentSelectedcheckout_field('Paytm');
Navigator.of(context).pop();
},
child: Column(
children: [
Image.asset(
'assets/images/paytm1.png', // Replace with the path to your Paytm image
height: 80,
),
Text('Paytm'),
],
),
),
SizedBox(height: 20),
GestureDetector(
onTap: () {
onPaymentSelectedcheckout_field('Razorpay');
Navigator.of(context).pop();
},
child: Column(
children: [
Image.asset(
'assets/images/razorpay.png', // Replace with the path to your Razorpay image
height: 80,
),
Text('Razorpay'),
],
),
),
],
),
actions: [
TextButton(
onPressed: () {
Navigator.of(context).pop();
},
child: Text('Close'),
),
],
);
},
);
}
late Future<List<Map<String, dynamic>>> _datagdataFuture; // Data from fetchData
final TextEditingController approved_fieldController = TextEditingController();
Future<List<Map<String, dynamic>>> datagfetchData() async {
final provider =
Provider.of<TestttViewModelScreen>(context, listen: false);
final resp = await provider.getdatagGrid();
if (resp != null) {
return resp;
} else {
throw Exception('Failed to load data: ');
}
}
@override
void initState() {
@ -182,10 +122,8 @@ final provider =
final provider = Provider.of<TestttViewModelScreen>(context, listen: false);
_value_list_fielddataFuture = value_list_fieldfetchData(); // Initialize _dataFuture with the function
_datagdataFuture = datagfetchData(); // Initialize _dataFuture with the function
}
@ -210,40 +148,7 @@ final provider =
centerTitle: true,
title: AppbarTitle(text: "Create Testtt"),
Padding(
padding: const EdgeInsets.only(right: 10),
child: InkWell(
onTap: () {
showvalue_list_fieldDialog(context);
},
borderRadius: BorderRadius.circular(12),
child: Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
gradient: const LinearGradient(
colors: [Colors.deepPurple, Colors.purpleAccent],
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: Colors.deepPurpleAccent.withOpacity(0.3),
spreadRadius: 2,
blurRadius: 8,
offset: const Offset(0, 3),
),
],
),
child: const Icon(
Icons.grid_on,
color: Colors.white,
size: 28,
),
),
),
),
@ -268,111 +173,67 @@ Padding(
Column(
children: [
Center(
child: SizedBox(
height: MediaQuery.of(context).size.height*0.2,
child: LottieBuilder.network('https://lottie.host/87ee095f-c45e-4171-afc6-c2dd90def749/FdaBGpEjHs.json',repeat: false,frameRate: FrameRate(120),),
),
),
Text("Successfull!",style: GoogleFonts.getFont('Lato',color: Colors.black,fontSize: 26,fontWeight: FontWeight.bold),),
Text("Transaction successful of \$340",style: GoogleFonts.getFont('Lato',color: Colors.grey,fontSize: 18,fontWeight: FontWeight.w500),),
SizedBox(height: 30,),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Divider(color: Colors.grey,thickness: 0.5,),
),
ListTile(
leading: Text("Transaction Number",style:GoogleFonts.getFont('Lato',color: Colors.grey,fontSize: 16,fontWeight: FontWeight.w400),),
trailing: Text("123 456 789",style:GoogleFonts.getFont('Lato',color: Colors.black,fontSize: 16,fontWeight: FontWeight.bold),),
),
ListTile(
leading: Text("Date",style:GoogleFonts.getFont('Lato',color: Colors.grey,fontSize: 16,fontWeight: FontWeight.w400),),
trailing: Text("20 May 2023 | 10:09",style:GoogleFonts.getFont('Lato',color: Colors.black,fontSize: 16,fontWeight: FontWeight.bold),),
),
ListTile(
leading: Text("Status",style:GoogleFonts.getFont('Lato',color: Colors.grey,fontSize: 16,fontWeight: FontWeight.w400),),
trailing: IntrinsicWidth(
child: Container(
decoration: BoxDecoration(
color: Colors.greenAccent.withOpacity(0.3),
borderRadius: BorderRadius.circular(18)
),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 12.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const Icon(Icons.check,color: Colors.green,),
Text("success",style:GoogleFonts.getFont('Lato',color: Colors.greenAccent.shade700,fontSize: 16,fontWeight: FontWeight.bold),),
],
),
)),
),
),
ListTile(
leading: Text("Type of Transaction",style:GoogleFonts.getFont('Lato',color: Colors.grey,fontSize: 16,fontWeight: FontWeight.w400),),
trailing: Text("Credit card",style:GoogleFonts.getFont('Lato',color: Colors.black,fontSize: 16,fontWeight: FontWeight.bold),),
),
ListTile(
leading: Text("Total",style:GoogleFonts.getFont('Lato',color: Colors.grey,fontSize: 16,fontWeight: FontWeight.w400),),
trailing: Text("\$340",style:GoogleFonts.getFont('Lato',color: Colors.black,fontSize: 16,fontWeight: FontWeight.bold),),
),
],
),
const SizedBox(width: 8),
CustomButton(
CustomButton(
height: getVerticalSize(50),
text: "Submit",
text: "Checkout",
margin: getMargin(top: 24, bottom: 5),
onTap: () async {
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
try {
print(formData);
Map<String, dynamic> createdEntity = await provider.createEntity(formData);
Navigator.pop(context);
} catch (e) {
// ignore: use_build_context_synchronously
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text('Error'),
content: Text('Failed to create Testtt: $e'),
actions: [
TextButton(
child: const Text('OK'),
onPressed: () {
Navigator.of(context).pop();
},
),
],
);
},
);
}
}
},
),
SizedBox(height: 16),
FutureBuilder<List<Map<String, dynamic>>>(
future: _datagdataFuture,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
} else if (snapshot.hasError) {
return Center(child: Text('Error: ${snapshot.error}'));
} else if (!snapshot.hasData || snapshot.data!.isEmpty) {
return const Center(child: Text('No data available..'));
} else {
final keys = snapshot.data!.first.keys.toList();
return SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: DataTable(
columnSpacing: 30,
headingRowColor: MaterialStateColor.resolveWith((states) => Colors.blue.shade100),
dataRowColor: MaterialStateColor.resolveWith((states) => Colors.white),
dividerThickness: 0.5,
columns: keys.map(
(key) => DataColumn(
label: Text(
key,
style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
),
),
)
.toList(),
rows: snapshot.data!.map((item) {
return DataRow(cells: keys.map((key) {
return DataCell(
Text(
item[key].toString(),
style: const TextStyle(fontSize: 14),
),
);
}).toList());
}).toList(),
),
);
}
},
),
SizedBox(height: 16),
],
onTap: _showPaymentOptionscheckout_field,
), ],
),
),
),

View File

@ -182,7 +182,7 @@ Future<void> fetchEntities() async {
entity['datag'].toString().toLowerCase().contains(keyword.toLowerCase())
entity['approved_field'].toString().toLowerCase().contains(keyword.toLowerCase())
).toList();
@ -524,6 +524,28 @@ onTapArrowleft1(BuildContext context) {
Padding(
padding: getPadding(
top: 10,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Approved Field : ",
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16,
),
Text(
entity['approved_field'].toString() ?? 'No Approved Field Available',
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.left,
style: AppStyle.txtGilroyMedium16Bluegray900,
),
],
),
),
],

View File

@ -104,6 +104,17 @@ class _testttUpdateEntityScreenState extends State<testttUpdateEntityScreen> {
ReusableTextField(
label: "Please Enter Approved Field",
initialValue: widget.entity['approved_field'] ?? '',
// ValidationProperties
onSaved: (value) => widget.entity['approved_field'] = value,
),
SizedBox(height: 16),
CustomButton(

View File

@ -63,14 +63,6 @@ class TestttRepoScreen {
Future<dynamic> getdatagGrid() async {
try {
String apiUrl = "$baseUrl/Testtt_ListFilter1/Testtt_ListFilter1";
final response = await _helper.getGetApiResponse(apiUrl);
return response;
} catch (e) {
throw Exception('Failed to Upload datag: $e');
}
}
}

View File

@ -102,21 +102,6 @@ class TestttViewModelScreen extends ChangeNotifier{
late List<Map<String, dynamic>> datagdataFuture =
[]; // Data from fetchData
Future<List<Map<String, dynamic>>> getdatagGrid() async {
try {
final value = await repo.getdatagGrid();
datagdataFuture = (value as List)
.map((item) => item as Map<String, dynamic>)
.toList();
return datagdataFuture;
} catch (e) {
throw Exception('Failed to get all: $e');
}
}
}

View File

@ -1,4 +1,5 @@
import '../../Entity/forma/Testtt/TestttView/Testtt_entity_list_screen.dart';
import '../../Entity/forma/Testtt/Testtt_viewModel/Testtt_view_model_screen.dart';
@ -76,6 +77,8 @@ Navigator.pushNamed(context, RouteNames.changePasswordView);
// NEW MENU
DrawerItem(
color: AppColors.primary,
icon: Icons.chat_bubble,

View File

@ -72,6 +72,9 @@ public class BuilderService {
addCustomMenu( "Testtt", "Transcations");
addCustomMenu( "Testtt", "Transcations");
addCustomMenu( "Testtt", "Transcations");

View File

@ -26,7 +26,7 @@ private String name;
private String approved_field_status;
}

View File

@ -75,7 +75,7 @@ old.setName(data.getName());
old.setApproved_field_status(data.getApproved_field_status());
final Testtt test = Repository.save(old);
data.setUpdatedBy(getUser().getUserId());

View File

@ -1,2 +1,2 @@
CREATE TABLE testdb.Testtt(id BIGINT NOT NULL AUTO_INCREMENT, datag VARCHAR(400), value_list_field VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));
CREATE TABLE testdb.Testtt(id BIGINT NOT NULL AUTO_INCREMENT, checkout_field VARCHAR(400), approved_field VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));