build_app

This commit is contained in:
risadmin_prod 2025-03-29 12:07:29 +00:00
parent 4ac402de09
commit 19635b65e9
8 changed files with 149 additions and 103 deletions

View File

@ -72,6 +72,9 @@ public class BuilderService {
addCustomMenu( "Forma", "Transcations"); addCustomMenu( "Forma", "Transcations");
addCustomMenu( "Forma", "Transcations");
System.out.println("dashboard and menu inserted..."); System.out.println("dashboard and menu inserted...");

View File

@ -1,2 +1,2 @@
CREATE TABLE db.Forma(id BIGINT NOT NULL AUTO_INCREMENT, datagg VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id)); CREATE TABLE db.Forma(id BIGINT NOT NULL AUTO_INCREMENT, valuelist VARCHAR(400), name VARCHAR(400), PRIMARY KEY (id));

View File

@ -53,13 +53,11 @@ final Map<String, dynamic> formData = {};
final TextEditingController nameController = TextEditingController(); final TextEditingController nameController = TextEditingController();
late Future<List<Map<String, dynamic>>> _dataggdataFuture; // Data from fetchData late Future<List<Map<String, dynamic>>> _valuelistdataFuture; // Data from fetchData
Future<List<Map<String, dynamic>>> dataggfetchData() async { Future<List<Map<String, dynamic>>> valuelistfetchData() async {
final provider = final resp = await apiService.getEntities();
Provider.of<FormaViewModelScreen>(context, listen: false);
final resp = await provider.getdataggGrid();
if (resp != null) { if (resp != null) {
return resp; return resp;
@ -69,13 +67,102 @@ final provider =
} }
void showvaluelistDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return SingleChildScrollView(
child: AlertDialog(
title: const Text('Select a record'),
content: FutureBuilder<List<Map<String, dynamic>>>(
future: _valuelistdataFuture,
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: () {
Navigator.of(context).pop();
},
),
],
),
);
},
);
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
final provider = Provider.of<FormaViewModelScreen>(context, listen: false); final provider = Provider.of<FormaViewModelScreen>(context, listen: false);
_dataggdataFuture = dataggfetchData(); // Initialize _dataFuture with the function _valuelistdataFuture = valuelistfetchData(); // Initialize _dataFuture with the function
} }
@ -100,7 +187,14 @@ final provider =
centerTitle: true, centerTitle: true,
title: AppbarTitle(text: "Create Forma"), title: AppbarTitle(text: "Create Forma"),
actions: [
IconButton(
icon: const Icon(Icons.grid_on),
onPressed: () {
showvaluelistDialog(context);
},
),
],
), ),
body: SingleChildScrollView( body: SingleChildScrollView(
@ -171,52 +265,6 @@ final provider =
), ),
SizedBox(height: 16),
FutureBuilder<List<Map<String, dynamic>>>(
future: _dataggdataFuture,
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),
], ],

View File

@ -172,15 +172,11 @@ Future<void> fetchEntities() async {
entity['name'].toString().toLowerCase().contains(keyword.toLowerCase()) || entity['name'].toString().toLowerCase().contains(keyword.toLowerCase())
entity['datagg'].toString().toLowerCase().contains(keyword.toLowerCase())
).toList(); ).toList();
}); });
} }

View File

@ -38,7 +38,7 @@ class _formaUpdateEntityScreenState extends State<formaUpdateEntityScreen> {
@override @override
@ -47,7 +47,7 @@ class _formaUpdateEntityScreenState extends State<formaUpdateEntityScreen> {
final provider = Provider.of<FormaViewModelScreen>(context, listen: false); final provider = Provider.of<FormaViewModelScreen>(context, listen: false);
} }
@ -95,7 +95,26 @@ class _formaUpdateEntityScreenState extends State<formaUpdateEntityScreen> {
SizedBox(height: 16), SizedBox(height: 16),
Padding(
padding: EdgeInsets.all(16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
ElevatedButton(
onPressed: () {
// Save changes logic here
Navigator.pop(context);
// Implement API call to update data
},
child: Text('Save'),
),
],
),
),
CustomButton( CustomButton(

View File

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

View File

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

View File

@ -1,5 +1,6 @@
import '../../Entity/basic/Forma/FormaView/Forma_entity_list_screen.dart';
import '../../Entity/basic/Forma/Forma_viewModel/Forma_view_model_screen.dart'; import '../../Entity/basic/Forma/FormaView/Forma_entity_list_screen.dart';
import '../../Entity/basic/Forma/Forma_viewModel/Forma_view_model_screen.dart';
import 'package:base_project/utils/image_constant.dart'; import 'package:base_project/utils/image_constant.dart';
import 'package:base_project/commans/widgets/custome_drawe_item.dart'; import 'package:base_project/commans/widgets/custome_drawe_item.dart';
@ -73,22 +74,24 @@ Navigator.pushNamed(context, RouteNames.changePasswordView);
), ),
// NEW MENU // NEW MENU
DrawerItem(
color: AppColors.primary,
icon: Icons.chat_bubble, DrawerItem(
title: 'Forma', color: AppColors.primary,
onTap: () { icon: Icons.chat_bubble,
Navigator.push( title: 'Forma',
context, onTap: () {
MaterialPageRoute( Navigator.push(
builder: (context) => ChangeNotifierProvider( context,
create: (context) => FormaViewModelScreen(), MaterialPageRoute(
child: forma_entity_list_screen(), builder: (context) => ChangeNotifierProvider(
), create: (context) => FormaViewModelScreen(),
), child: forma_entity_list_screen(),
); ),
}, ),
), );
},
),
DrawerItem( DrawerItem(