build_app
This commit is contained in:
parent
656d2cd093
commit
93ce2f5e47
@ -72,6 +72,9 @@ public class BuilderService {
|
|||||||
addCustomMenu( "Testf", "Transcations");
|
addCustomMenu( "Testf", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
addCustomMenu( "Testf", "Transcations");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
System.out.println("dashboard and menu inserted...");
|
System.out.println("dashboard and menu inserted...");
|
||||||
|
|
||||||
|
|||||||
@ -10,10 +10,9 @@ import com.realnet.config.EmailService;
|
|||||||
import com.realnet.users.entity1.AppUser;
|
import com.realnet.users.entity1.AppUser;
|
||||||
import com.realnet.users.service1.AppUserServiceImpl;
|
import com.realnet.users.service1.AppUserServiceImpl;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.*;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import com.realnet.fnd.response.EntityResponse;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.*;
|
||||||
import org.springframework.data.domain.Pageable;
|
|
||||||
import org.springframework.beans.factory.annotation.*;
|
import org.springframework.beans.factory.annotation.*;
|
||||||
import com.realnet.basic1.Entity.Testf;
|
import com.realnet.basic1.Entity.Testf;
|
||||||
import com.realnet.basic1.Services.TestfService ;
|
import com.realnet.basic1.Services.TestfService ;
|
||||||
@ -85,8 +84,9 @@ public class TestfController {
|
|||||||
return get;
|
return get;
|
||||||
}
|
}
|
||||||
@DeleteMapping("/Testf/{id}")
|
@DeleteMapping("/Testf/{id}")
|
||||||
public void delete_by_id(@PathVariable Integer id ) {
|
public ResponseEntity<?> delete_by_id(@PathVariable Integer id ) {
|
||||||
Service.delete_by_id(id);
|
Service.delete_by_id(id);
|
||||||
|
return new ResponseEntity<>(new EntityResponse("Deleted"), HttpStatus.OK);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,7 +10,6 @@ import com.realnet.WhoColumn.Entity.Extension;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Entity
|
@Entity
|
||||||
@Data
|
@Data
|
||||||
public class Testf extends Extension {
|
public class Testf extends Extension {
|
||||||
|
|||||||
@ -1,17 +1,16 @@
|
|||||||
package com.realnet.basic1.Services;
|
package com.realnet.basic1.Services;
|
||||||
import com.realnet.basic1.Repository.TestfRepository;
|
import com.realnet.basic1.Repository.TestfRepository;
|
||||||
import com.realnet.basic1.Entity.Testf;import java.util.List;
|
import com.realnet.basic1.Entity.Testf
|
||||||
import java.util.ArrayList;
|
;import java.util.*;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import com.realnet.SequenceGenerator.Service.SequenceService;
|
import com.realnet.SequenceGenerator.Service.SequenceService;
|
||||||
import com.realnet.Notification.Entity.NotificationService;
|
import com.realnet.Notification.Entity.NotificationService;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import com.realnet.realm.Entity.Realm;
|
import com.realnet.realm.Entity.Realm;
|
||||||
import com.realnet.realm.Services.RealmService;import org.springframework.data.domain.Pageable;
|
import com.realnet.realm.Services.RealmService;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.data.domain.Pageable;
|
||||||
import com.realnet.users.service1.AppUserServiceImpl;
|
import org.springframework.http.*;import com.realnet.users.service1.AppUserServiceImpl;
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import com.realnet.users.entity1.AppUser;
|
import com.realnet.users.entity1.AppUser;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -17,7 +17,6 @@ import '../../../../widgets/custom_dropdown_field.dart';
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
import 'package:qr_flutter/qr_flutter.dart';
|
import 'package:qr_flutter/qr_flutter.dart';
|
||||||
import 'package:barcode_widget/barcode_widget.dart';
|
import 'package:barcode_widget/barcode_widget.dart';
|
||||||
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
|
import 'package:autocomplete_textfield/autocomplete_textfield.dart';
|
||||||
@ -32,8 +31,16 @@ import 'package:just_audio/just_audio.dart';
|
|||||||
import 'package:video_player/video_player.dart';
|
import 'package:video_player/video_player.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:lottie/lottie.dart';
|
import 'package:lottie/lottie.dart';
|
||||||
|
import '../../../../utils/toast_messages/toast_message_util.dart';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import '../../../../Reuseable/reusable_text_field.dart';
|
import '../../../../Reuseable/reusable_text_field.dart';
|
||||||
|
import '../../../../Reuseable/reusable_dropdown_field.dart';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class testfCreateEntityScreen extends StatefulWidget {
|
class testfCreateEntityScreen extends StatefulWidget {
|
||||||
const testfCreateEntityScreen({super.key});
|
const testfCreateEntityScreen({super.key});
|
||||||
|
|
||||||
@ -63,6 +70,7 @@ void _toggleSwitchactive(bool value) {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
final provider = Provider.of<TestfViewModelScreen>(context, listen: false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -75,6 +83,7 @@ void _toggleSwitchactive(bool value) {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final provider = Provider.of<TestfViewModelScreen>(context, listen: false);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: CustomAppBar(
|
appBar: CustomAppBar(
|
||||||
height: getVerticalSize(49),
|
height: getVerticalSize(49),
|
||||||
@ -95,9 +104,7 @@ void _toggleSwitchactive(bool value) {
|
|||||||
|
|
||||||
|
|
||||||
),
|
),
|
||||||
body:Consumer<TestfViewModelScreen>(
|
body: SingleChildScrollView(
|
||||||
builder: (context, value, child) {
|
|
||||||
return SingleChildScrollView(
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Form(
|
child: Form(
|
||||||
@ -155,7 +162,7 @@ formData['active'] = active;
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
print(formData);
|
print(formData);
|
||||||
Map<String, dynamic> createdEntity = await value.createEntity(formData);
|
Map<String, dynamic> createdEntity = await provider.createEntity(formData);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -198,7 +205,7 @@ formData['active'] = active;
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
}));
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,9 +1,9 @@
|
|||||||
// ignore_for_file: use_build_context_synchronously
|
// ignore_for_file: use_build_context_synchronously
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'Testf_api_service.dart';
|
|
||||||
import 'Testf_create_entity_screen.dart';
|
import 'Testf_create_entity_screen.dart';
|
||||||
import 'Testf_update_entity_screen.dart';
|
import 'Testf_update_entity_screen.dart';
|
||||||
|
import '../Testf_viewModel/Testf_view_model_screen.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:speech_to_text/speech_to_text.dart' as stt;
|
import 'package:speech_to_text/speech_to_text.dart' as stt;
|
||||||
import '../../../../theme/app_style.dart';
|
import '../../../../theme/app_style.dart';
|
||||||
@ -16,6 +16,7 @@ import '../../../../widgets/app_bar/custom_app_bar.dart';
|
|||||||
import '../../../../theme/app_decoration.dart';
|
import '../../../../theme/app_decoration.dart';
|
||||||
import 'package:multi_select_flutter/multi_select_flutter.dart';
|
import 'package:multi_select_flutter/multi_select_flutter.dart';
|
||||||
import '../../../../Reuseable/reusable_text_field.dart';
|
import '../../../../Reuseable/reusable_text_field.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'package:fluttertoast/fluttertoast.dart';
|
import 'package:fluttertoast/fluttertoast.dart';
|
||||||
|
|
||||||
class testf_entity_list_screen extends StatefulWidget {
|
class testf_entity_list_screen extends StatefulWidget {
|
||||||
@ -26,8 +27,6 @@ class testf_entity_list_screen extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _testf_entity_list_screenState extends State<testf_entity_list_screen> {
|
class _testf_entity_list_screenState extends State<testf_entity_list_screen> {
|
||||||
|
|
||||||
final testfApiService apiService = testfApiService();
|
|
||||||
List<Map<String, dynamic>> entities = [];
|
List<Map<String, dynamic>> entities = [];
|
||||||
List<Map<String, dynamic>> filteredEntities = [];
|
List<Map<String, dynamic>> filteredEntities = [];
|
||||||
List<Map<String, dynamic>> serachEntities = [];
|
List<Map<String, dynamic>> serachEntities = [];
|
||||||
@ -58,8 +57,9 @@ class _testf_entity_list_screenState extends State<testf_entity_list_screen> {
|
|||||||
|
|
||||||
Future<void> fetchwithoutpaging() async {
|
Future<void> fetchwithoutpaging() async {
|
||||||
try {
|
try {
|
||||||
final fetchedEntities =
|
final provider =
|
||||||
await apiService.getEntities();
|
Provider.of<TestfViewModelScreen>(context, listen: false);
|
||||||
|
final fetchedEntities = await provider.getEntities();
|
||||||
print('withoutpaging data is $fetchedEntities');
|
print('withoutpaging data is $fetchedEntities');
|
||||||
setState(() {
|
setState(() {
|
||||||
serachEntities = fetchedEntities; // Update only filteredEntities
|
serachEntities = fetchedEntities; // Update only filteredEntities
|
||||||
@ -93,8 +93,10 @@ Future<void> fetchEntities() async {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
final fetchedEntities =
|
final provider =
|
||||||
await apiService.getAllWithPagination( currentPage, pageSize);
|
Provider.of<TestfViewModelScreen>(context, listen: false);
|
||||||
|
final fetchedEntities =
|
||||||
|
await provider.getAllWithPagination(currentPage, pageSize);
|
||||||
print('pagination data is $fetchedEntities');
|
print('pagination data is $fetchedEntities');
|
||||||
setState(() {
|
setState(() {
|
||||||
entities.addAll(fetchedEntities); // Add new data to the existing list
|
entities.addAll(fetchedEntities); // Add new data to the existing list
|
||||||
@ -137,7 +139,10 @@ Future<void> fetchEntities() async {
|
|||||||
|
|
||||||
Future<void> deleteEntity(Map<String, dynamic> entity) async {
|
Future<void> deleteEntity(Map<String, dynamic> entity) async {
|
||||||
try {
|
try {
|
||||||
await apiService.deleteEntity(entity['id']);
|
final provider =
|
||||||
|
Provider.of<TestfViewModelScreen>(context, listen: false);
|
||||||
|
|
||||||
|
await provider.deleteEntity(entity['id']);;
|
||||||
setState(() {
|
setState(() {
|
||||||
entities.remove(entity);
|
entities.remove(entity);
|
||||||
});
|
});
|
||||||
@ -325,7 +330,10 @@ onTapArrowleft1(BuildContext context) {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => testfCreateEntityScreen(),
|
builder: (context) => ChangeNotifierProvider(
|
||||||
|
create: (context) => TestfViewModelScreen(),
|
||||||
|
child: testfCreateEntityScreen(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
).then((_) {
|
).then((_) {
|
||||||
fetchEntities();
|
fetchEntities();
|
||||||
@ -446,11 +454,13 @@ onTapArrowleft1(BuildContext context) {
|
|||||||
},
|
},
|
||||||
onSelected: (String value) {
|
onSelected: (String value) {
|
||||||
if (value == 'edit') {
|
if (value == 'edit') {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) => ChangeNotifierProvider(
|
||||||
testfUpdateEntityScreen(entity: entity),
|
create: (context) => TestfViewModelScreen(),
|
||||||
|
child: testfUpdateEntityScreen(entity: entity),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
).then((_) {
|
).then((_) {
|
||||||
fetchEntities();
|
fetchEntities();
|
||||||
|
|||||||
@ -21,6 +21,7 @@ import 'dart:math';
|
|||||||
import '../../../../Reuseable/reusable_text_field.dart';
|
import '../../../../Reuseable/reusable_text_field.dart';
|
||||||
import '../../../../Reuseable/reusable_date_picker_field.dart';
|
import '../../../../Reuseable/reusable_date_picker_field.dart';
|
||||||
import '../../../../Reuseable/reusable_date_time_picker_field.dart';
|
import '../../../../Reuseable/reusable_date_time_picker_field.dart';
|
||||||
|
import '../../../../Reuseable/reusable_dropdown_field.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
class testfUpdateEntityScreen extends StatefulWidget {
|
class testfUpdateEntityScreen extends StatefulWidget {
|
||||||
final Map<String, dynamic> entity;
|
final Map<String, dynamic> entity;
|
||||||
@ -45,6 +46,7 @@ class _testfUpdateEntityScreenState extends State<testfUpdateEntityScreen> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
final provider = Provider.of<TestfViewModelScreen>(context, listen: false);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -56,6 +58,7 @@ isactive = widget.entity['active'] ?? false; // Set initial value
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final provider = Provider.of<TestfViewModelScreen>(context, listen: false);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: CustomAppBar(
|
appBar: CustomAppBar(
|
||||||
height: getVerticalSize(49),
|
height: getVerticalSize(49),
|
||||||
@ -78,8 +81,7 @@ isactive = widget.entity['active'] ?? false; // Set initial value
|
|||||||
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Consumer<TestfViewModelScreen>(builder: (context, value, child) {
|
body: SingleChildScrollView(
|
||||||
return SingleChildScrollView(
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(16),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Form(
|
child: Form(
|
||||||
@ -142,7 +144,7 @@ widget.entity['active'] = isactive;
|
|||||||
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await value.updateEntity(
|
await provider.updateEntity(
|
||||||
widget.entity[
|
widget.entity[
|
||||||
'id'], // Assuming 'id' is the key in your entity map
|
'id'], // Assuming 'id' is the key in your entity map
|
||||||
widget.entity);
|
widget.entity);
|
||||||
@ -182,7 +184,7 @@ widget.entity['active'] = isactive;
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
import '../../../../data/network/base_network_service.dart';
|
import '../../../../data/network/base_network_service.dart';
|
||||||
import '../../../../data/network/network_api_service.dart';
|
import '../../../../data/network/network_api_service.dart';
|
||||||
import '../../../../resources/api_constants.dart';
|
import '../../../../resources/api_constants.dart';
|
||||||
@ -58,4 +59,10 @@ class TestfRepoScreen {
|
|||||||
throw Exception('Failed to delete entity: $e');
|
throw Exception('Failed to delete entity: $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,11 @@
|
|||||||
|
import 'dart:typed_data';
|
||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:http_parser/http_parser.dart';
|
||||||
|
import '../../../../utils/toast_messages/toast_message_util.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
import '../Testf_Repo/Testf_repo_screen.dart';
|
import '../Testf_Repo/Testf_repo_screen.dart';
|
||||||
|
|
||||||
class TestfViewModelScreen {
|
class TestfViewModelScreen extends ChangeNotifier{
|
||||||
final TestfRepoScreen repo = TestfRepoScreen();
|
final TestfRepoScreen repo = TestfRepoScreen();
|
||||||
|
|
||||||
Future<List<Map<String, dynamic>>> getEntities() async {
|
Future<List<Map<String, dynamic>>> getEntities() async {
|
||||||
@ -13,40 +18,64 @@ class TestfViewModelScreen {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<List<Map<String, dynamic>>> getAllWithPagination(
|
Future<List<Map<String, dynamic>>> getAllWithPagination(
|
||||||
int page, int size) async {
|
int page, int size) async {
|
||||||
try {
|
try {
|
||||||
final response = repo.getAllWithPagination(page, size);
|
final response =
|
||||||
|
await repo.getAllWithPagination(page, size); // ✅ Use await
|
||||||
|
|
||||||
Map<String, dynamic> responseData = response as Map<String, dynamic>;
|
print('res - $response');
|
||||||
|
|
||||||
final entities =
|
// ✅ Ensure response is a Map<String, dynamic>
|
||||||
(responseData['content'] as List).cast<Map<String, dynamic>>();
|
if (response is! Map<String, dynamic>) {
|
||||||
|
throw Exception('Unexpected response format: $response');
|
||||||
|
}
|
||||||
|
|
||||||
|
// ✅ Extract 'content' and ensure it's a list
|
||||||
|
final entities = (response['content'] as List)
|
||||||
|
.cast<Map<String, dynamic>>() // ✅ Ensure list of maps
|
||||||
|
.toList();
|
||||||
return entities;
|
return entities;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw Exception('Failed to get all without pagination: $e');
|
print(e);
|
||||||
|
throw Exception('Failed to get all without pagination :- $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<Map<String, dynamic>> createEntity(Map<String, dynamic> entity) async {
|
Future<Map<String, dynamic>> createEntity(Map<String, dynamic> entity) async {
|
||||||
try {
|
try {
|
||||||
print("in post api$entity");
|
print("in post api - $entity");
|
||||||
final response = repo.createEntity(entity);
|
// Wait for API response
|
||||||
|
final responseData =
|
||||||
|
await repo.createEntity(entity) as Map<String, dynamic>;
|
||||||
|
print('after value - $responseData');
|
||||||
|
ToastMessageUtil.showToast(
|
||||||
|
message: "Added Successfully", toastType: ToastType.success);
|
||||||
|
|
||||||
print(entity);
|
return responseData; // Return the data AFTER it is received
|
||||||
|
} catch (error) {
|
||||||
|
print("error--$error");
|
||||||
|
ToastMessageUtil.showToast(
|
||||||
|
message: "Got Error", toastType: ToastType.error);
|
||||||
|
|
||||||
// Assuming the response is a Map<String, dynamic>
|
throw Exception(
|
||||||
Map<String, dynamic> responseData = response as Map<String, dynamic>;
|
'Failed to Create Entity: $error'); // Properly rethrow the error
|
||||||
|
|
||||||
return responseData;
|
|
||||||
} catch (e) {
|
|
||||||
throw Exception('Failed to create entity: $e');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateEntity(int entityId, Map<String, dynamic> entity) async {
|
Future<void> updateEntity(int entityId, Map<String, dynamic> entity) async {
|
||||||
try {
|
try {
|
||||||
repo.updateEntity(entityId, entity);
|
repo.updateEntity(entityId, entity).then((value) {
|
||||||
|
ToastMessageUtil.showToast(
|
||||||
|
message: "Updated Successfully", toastType: ToastType.success);
|
||||||
|
}).onError(
|
||||||
|
(error, stackTrace) {
|
||||||
|
print("error--$error");
|
||||||
|
ToastMessageUtil.showToast(
|
||||||
|
message: "Got Error", toastType: ToastType.error);
|
||||||
|
},
|
||||||
|
);
|
||||||
print(entity);
|
print(entity);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw Exception('Failed to update entity: $e');
|
throw Exception('Failed to update entity: $e');
|
||||||
@ -55,9 +84,24 @@ class TestfViewModelScreen {
|
|||||||
|
|
||||||
Future<void> deleteEntity(int entityId) async {
|
Future<void> deleteEntity(int entityId) async {
|
||||||
try {
|
try {
|
||||||
repo.deleteEntity(entityId);
|
repo.deleteEntity(entityId).then((value) {
|
||||||
|
ToastMessageUtil.showToast(
|
||||||
|
message: "Deleted Successfully", toastType: ToastType.success);
|
||||||
|
}).onError(
|
||||||
|
(error, stackTrace) {
|
||||||
|
print("error--$error");
|
||||||
|
ToastMessageUtil.showToast(
|
||||||
|
message: "Got Error", toastType: ToastType.error);
|
||||||
|
},
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
throw Exception('Failed to delete entity: $e');
|
throw Exception('Failed to delete entity: $e');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
import '../../Entity/basic1/Testf/TestfView/Testf_entity_list_screen.dart';
|
import '../../Entity/basic1/Testf/TestfView/Testf_entity_list_screen.dart';
|
||||||
|
|
||||||
import 'package:base_project/utils/image_constant.dart';
|
import 'package:base_project/utils/image_constant.dart';
|
||||||
@ -11,92 +12,94 @@ import 'package:flutter_svg/svg.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
class MyCustomDrawer extends StatelessWidget {
|
class MyCustomDrawer extends StatelessWidget {
|
||||||
const MyCustomDrawer({super.key});
|
const MyCustomDrawer({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final email = UserManager().email;
|
final email = UserManager().email;
|
||||||
final userName = UserManager().userName;
|
final userName = UserManager().userName;
|
||||||
final provider = Provider.of<ProfileViewModel>(context, listen: false);
|
final provider = Provider.of<ProfileViewModel>(context, listen: false);
|
||||||
return Drawer(
|
return Drawer(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
UserAccountsDrawerHeader(
|
UserAccountsDrawerHeader(
|
||||||
decoration: const BoxDecoration(
|
decoration: const BoxDecoration(
|
||||||
color: AppColors.primary,
|
color: AppColors.primary,
|
||||||
),
|
),
|
||||||
currentAccountPicture: CircleAvatar(
|
currentAccountPicture: CircleAvatar(
|
||||||
radius: 60,
|
radius: 60,
|
||||||
backgroundColor: AppColors.primary.withOpacity(0.3),
|
backgroundColor: AppColors.primary.withOpacity(0.3),
|
||||||
backgroundImage: provider.profileImageBytes != null
|
backgroundImage: provider.profileImageBytes != null
|
||||||
? MemoryImage(provider.profileImageBytes!)
|
? MemoryImage(provider.profileImageBytes!)
|
||||||
: null,
|
: null,
|
||||||
child: provider.profileImageBytes != null
|
child: provider.profileImageBytes != null
|
||||||
? null // Use backgroundImage for the actual image, so child should be null
|
? null // Use backgroundImage for the actual image, so child should be null
|
||||||
: SvgPicture.asset(
|
: SvgPicture.asset(
|
||||||
ImageConstant.userProfileImg, // Placeholder SVG asset
|
ImageConstant.userProfileImg, // Placeholder SVG asset
|
||||||
|
|
||||||
// AppImages.userProfileImg, // Placeholder SVG asset
|
// AppImages.userProfileImg, // Placeholder SVG asset
|
||||||
width: 60, // Adjust to fit the CircleAvatar
|
width: 60, // Adjust to fit the CircleAvatar
|
||||||
height: 60,
|
height: 60,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
accountName: Text("Hello, $userName"),
|
accountName: Text("Hello, $userName"),
|
||||||
accountEmail: Text(email.toString()),
|
accountEmail: Text(email.toString()),
|
||||||
),
|
),
|
||||||
DrawerItem(
|
DrawerItem(
|
||||||
color: AppColors.primary,
|
color: AppColors.primary,
|
||||||
icon: Icons.person,
|
icon: Icons.person,
|
||||||
title: 'Profile',
|
title: 'Profile',
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pushNamed(context, RouteNames.profileView);
|
Navigator.pushNamed(context, RouteNames.profileView);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
DrawerItem(
|
DrawerItem(
|
||||||
color: AppColors.primary,
|
color: AppColors.primary,
|
||||||
icon: Icons.system_security_update,
|
icon: Icons.system_security_update,
|
||||||
title: 'System Parameters',
|
title: 'System Parameters',
|
||||||
onTap: () {
|
onTap: () {
|
||||||
// Add navigation or other logic here
|
// Add navigation or other logic here
|
||||||
Navigator.pushNamed(context, RouteNames.systemParamsView);
|
Navigator.pushNamed(context, RouteNames.systemParamsView);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
DrawerItem(
|
DrawerItem(
|
||||||
color: AppColors.primary,
|
color: AppColors.primary,
|
||||||
icon: Icons.password,
|
icon: Icons.password,
|
||||||
title: 'change password',
|
title: 'change password',
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pushNamed(context, RouteNames.changePasswordView);
|
Navigator.pushNamed(context, RouteNames.changePasswordView);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
||||||
// NEW MENU
|
// NEW MENU
|
||||||
DrawerItem(
|
|
||||||
color: AppColors.primary,
|
|
||||||
icon: Icons.chat_bubble,
|
|
||||||
title: 'Testf',
|
|
||||||
onTap: () {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(
|
|
||||||
builder: (context) => testf_entity_list_screen(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
|
|
||||||
DrawerItem(
|
|
||||||
icon: Icons.logout,
|
DrawerItem(
|
||||||
color: Colors.red,
|
color: AppColors.primary,
|
||||||
title: 'Logout',
|
icon: Icons.chat_bubble,
|
||||||
onTap: () async {
|
title: 'Testf',
|
||||||
await UserManager().clearUser();
|
onTap: () {
|
||||||
Navigator.pushReplacementNamed(context, RouteNames.splashView);
|
Navigator.push(
|
||||||
},
|
context,
|
||||||
),
|
MaterialPageRoute(
|
||||||
],
|
builder: (context) => testf_entity_list_screen(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
DrawerItem(
|
||||||
|
icon: Icons.logout,
|
||||||
|
color: Colors.red,
|
||||||
|
title: 'Logout',
|
||||||
|
onTap: () async {
|
||||||
|
await UserManager().clearUser();
|
||||||
|
Navigator.pushReplacementNamed(context, RouteNames.splashView);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user