Commit 3ad2ea55 authored by Sai Srinivas's avatar Sai Srinivas
Browse files

ios Changes

parent 38d17dba
......@@ -227,7 +227,6 @@ class Paymentdetailsprovider extends ChangeNotifier {
if (data.error == 0) {
print(data.paymentCollectionId);
_CollectionId = data.paymentCollectionId ?? 0;
notifyListeners();
} else {}
} else {
......@@ -427,7 +426,7 @@ class Paymentdetailsprovider extends ChangeNotifier {
email,
) async {
if (actName == "Generator") {
_saveAgainst = "Generator";
_saveAgainst = "generator";
_genId = generatorID;
} else {
_saveAgainst = "account";
......
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'dart:async';
class Connectivityprovider extends ChangeNotifier {
static final Connectivityprovider _instance = Connectivityprovider._();
static Connectivityprovider get instance => _instance;
final Connectivity _connectivity = Connectivity();
bool _isOnline = false;
Map<ConnectivityResult, bool> _source = {ConnectivityResult.none: false};
Connectivityprovider._() {
initialise();
}
bool get isOnline => _isOnline;
Map<ConnectivityResult, bool> get source => _source;
void initialise() async {
List<ConnectivityResult> result = await _connectivity.checkConnectivity();
_checkStatus(result.first);
_connectivity.onConnectivityChanged.listen((result) {
_checkStatus(result.first);
});
}
void _checkStatus(ConnectivityResult result) async {
bool isOnline = false;
try {
final lookupResult = await InternetAddress.lookup('example.com');
isOnline =
lookupResult.isNotEmpty && lookupResult[0].rawAddress.isNotEmpty;
} on SocketException catch (_) {
isOnline = false;
}
_source = {result: isOnline};
_isOnline = isOnline;
notifyListeners(); // Notify all listeners of the change
}
void dispose() {
// No StreamController to close, as we're using ChangeNotifier
}
}
......@@ -483,12 +483,11 @@ class Requestionlistprovider extends ChangeNotifier {
approvalEmployeeID,
) async {
try {
_submitClicked = true;
notifyListeners();
if (!validateForm(context, mode)) {
_submitClicked = false;
return;
}
_submitClicked = true;
notifyListeners();
var homeProvider = Provider.of<HomescreenNotifier>(
context,
......@@ -511,8 +510,8 @@ class Requestionlistprovider extends ChangeNotifier {
bankIfscController.text,
bankAcHolderController.text,
bankUpiController.text,
_image,
approvalEmployeeID,
_image,
);
if (data != null) {
if (data.error == "0") {
......@@ -550,11 +549,20 @@ class Requestionlistprovider extends ChangeNotifier {
if (data != null) {
if (data.error == "0") {
_directPaymentAccounts = data.paymentAccounts!;
_directPaymentAccounts = [DirectPaymentAccounts(id: "",name: "Select"),...data.paymentAccounts!];
_directPaymentAccounts = [
DirectPaymentAccounts(id: "", name: "Select"),
...data.paymentAccounts!,
];
_directPaymentModes = data.paymentModes!;
_directPaymentModes = [DirectPaymentModes(name: "Select",id: ""),...data.paymentModes!];
_directPaymentModes = [
DirectPaymentModes(name: "Select", id: ""),
...data.paymentModes!,
];
_directAccounts = data.accounts!;
_directAccounts = [DirectAccounts(id: "",name: "Select"),...data.accounts!];
_directAccounts = [
DirectAccounts(id: "", name: "Select"),
...data.accounts!,
];
checkdirectPaymentDropDownsSlected();
notifyListeners();
......@@ -1058,6 +1066,14 @@ class Requestionlistprovider extends ChangeNotifier {
!_requestingPurposes.contains(_selectReqPurpose)) {
_selectReqPurpose = null;
}
if (_selectedApprovalEmployee != null &&
!_approvalEmployee.contains(_selectedApprovalEmployee)) {
_selectedApprovalEmployee = null;
_selectedApprovalEmployeeID = null;
_selectedApprovalEmployeeValue = null;
}
notifyListeners();
}
bool validateForm(BuildContext context, String mode) {
......@@ -1156,6 +1172,7 @@ class Requestionlistprovider extends ChangeNotifier {
// isValid = false;_submitClicked = false;
// }
buttonEnabled = isValid;
_submitClicked = true;
notifyListeners();
return isValid;
}
......
......@@ -42,7 +42,7 @@ class SplashVersionNotifier extends ChangeNotifier {
if (_packagedetails.isEmpty) {
await initPackageInfo();
}
var loginProvider = Provider.of<Loginnotifier>(context,listen: false);
var loginProvider = Provider.of<Loginnotifier>(context, listen: false);
var loginStatus = await SharedpreferencesService().getInt("loginStatus");
print("login status: ${loginStatus}");
......@@ -59,7 +59,6 @@ class SplashVersionNotifier extends ChangeNotifier {
}
if (Platform.isAndroid &&
currentBuild < (data.latestVersionCode ?? 0)) {
print("Update");
AppUpdateDialouge(context, data.url!, data.releaseNotes!);
} else if (Platform.isIOS &&
......
String didPushed = "";
String didPopped = "";
\ No newline at end of file
String didPopped = "";
var connection;
import 'dart:async';
import 'dart:io';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
toast(context,text) {
toast(context, text) {
// OwnToast(context, text, "0");
Fluttertoast.showToast(
msg: text,
......@@ -13,4 +16,36 @@ toast(context,text) {
textColor: Colors.white,
fontSize: 15.0,
);
}
\ No newline at end of file
}
class MyConnectivity {
MyConnectivity._();
static final _instance = MyConnectivity._();
static MyConnectivity get instance => _instance;
final _connectivity = Connectivity();
final _controller = StreamController.broadcast();
Stream get myStream => _controller.stream;
void initialise() async {
ConnectivityResult result =
(await _connectivity.checkConnectivity()) as ConnectivityResult;
_checkStatus(result);
_connectivity.onConnectivityChanged.listen((result) {
_checkStatus(result as ConnectivityResult);
});
}
void _checkStatus(ConnectivityResult result) async {
bool isOnline = false;
try {
final result = await InternetAddress.lookup('example.com');
isOnline = result.isNotEmpty && result[0].rawAddress.isNotEmpty;
} on SocketException catch (_) {
isOnline = false;
}
_controller.sink.add({result: isOnline});
}
void disposeStream() => _controller.close();
}
......@@ -141,7 +141,7 @@ Widget textControllerWidget(
height: hintText == "Enter Description" ? 150 : 50,
alignment: Alignment.center,
decoration: BoxDecoration(
color:readonly?Color(0xFFD7D7D7): AppColors.text_field_color,
color: readonly ? Color(0xFFD7D7D7) : AppColors.text_field_color,
borderRadius: BorderRadius.circular(14),
),
child: Padding(
......@@ -175,7 +175,7 @@ Widget textControllerWidget(
? [FilteringTextInputFormatter.digitsOnly]
: [],
style: TextStyle(
color: readonly?Color(0xFF9e9e9e):AppColors.semi_black
color: readonly ? Color(0xFF9e9e9e) : AppColors.semi_black,
),
decoration: InputDecoration(
counterText: "",
......@@ -198,12 +198,13 @@ Widget textControllerWidget(
NoNetwork(context) {
return Container(
decoration: BoxDecoration(color: AppColors.scaffold_bg_color),
height: MediaQuery.of(context).size.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset('assets/images/no_wifi.png', width: 100, height: 100),
// Image.asset('assets/images/no_wifi.png', width: 100, height: 100),
SizedBox(height: 10),
Center(
child: Text(
......
......@@ -247,8 +247,7 @@ class MyApp extends StatelessWidget {
tabBarTheme: const TabBarThemeData(),
textSelectionTheme: TextSelectionThemeData(
cursorColor: AppColors.app_blue
cursorColor: AppColors.app_blue,
),
dialogTheme: const DialogThemeData(
shadowColor: Colors.white,
......@@ -296,7 +295,7 @@ class MyApp extends StatelessWidget {
AppColors.grey_semi.withOpacity(0.6),
),
),
useMaterial3: true
useMaterial3: true,
// inputDecorationTheme: InputDecorationTheme(
// hintStyle: TextStyle(
// fontWeight: FontWeight.w400,
......
This diff is collapsed.
......@@ -77,205 +77,201 @@ class _WebERPIOSState extends State<WebERPIOS> {
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
if (await webViewController!.canGoBack()) {
webViewController!.goBack();
return false; // Prevent default back button behavior
}
return true; // Allow default back button behavior
},
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
appBar: appbar(context, "ERP"),
body: Container(
child: Column(
children: <Widget>[
Expanded(
child: Stack(
children: [
InAppWebView(
initialUrlRequest: URLRequest(
url: WebUri(widget.url.toString()),
),
androidOnGeolocationPermissionsShowPrompt: (
InAppWebViewController controller,
String origin,
) async {
return GeolocationPermissionShowPromptResponse(
origin: origin,
allow: true,
retain: true,
);
},
initialOptions: InAppWebViewGroupOptions(
android: AndroidInAppWebViewOptions(
useWideViewPort: true,
loadWithOverviewMode: true,
allowContentAccess: true,
geolocationEnabled: true,
allowFileAccess: true,
databaseEnabled: true, // Enables the WebView database
domStorageEnabled: true, // Enables DOM storage
builtInZoomControls:
true, // Enables the built-in zoom controls
displayZoomControls:
false, // Disables displaying zoom controls
safeBrowsingEnabled: true, // Enables Safe Browsing
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
allowsLinkPreview: true,
allowsBackForwardNavigationGestures: true,
),
),
androidOnPermissionRequest: (
InAppWebViewController controller,
String origin,
List<String> resources,
) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT,
);
},
initialSettings: InAppWebViewSettings(
javaScriptEnabled: true,
allowFileAccess: true,
allowContentAccess: true,
clearCache: true,
blockNetworkLoads: false,
networkAvailable: true,
useOnLoadResource: true,
thirdPartyCookiesEnabled: true,
supportZoom: false,
geolocationEnabled: true,
safeBrowsingEnabled: false,
saveFormData: true,
allowFileAccessFromFileURLs: true,
useWideViewPort: true,
databaseEnabled: true,
domStorageEnabled: true,
allowsBackForwardNavigationGestures: true,
allowUniversalAccessFromFileURLs: true,
allowsLinkPreview: true,
),
onPermissionRequest: (controller, request) async {
return PermissionResponse(
resources: request.resources,
action: PermissionResponseAction.GRANT,
);
},
keepAlive: InAppWebViewKeepAlive(),
// initialData:
// InAppWebViewInitialData(baseUrl: WebUri(widget.url),data: ),
onWebViewCreated: (controller) {
webViewController = controller;
_controller.complete(controller);
},
pullToRefreshController: pullToRefreshController,
shouldOverrideUrlLoading: (
controller,
navigationAction,
) async {
var uri = navigationAction.request.url!;
print("urib scgefes");
print(uri);
print(uri.scheme);
if (uri.scheme == "tel") {
// Launch the phone dialer app with the specified phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "mailto") {
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "whatsapp") {
// Launch WhatsApp with the specified chat or phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
}
// // Check if the URL is trying to access the camera for image upload
// if (uri.scheme == 'camera' && uri.path.contains('/camera/')) {
// // Handle camera image upload here
// // You might want to display a custom UI for image selection or directly trigger the camera
// // You can use platform-specific plugins like image_picker for this purpose
// // Once the image is selected, you can pass it to the web view using JavaScript injection
// if (await canLaunch(uri.toString())) {
// await launch(uri.toString());
// return NavigationActionPolicy.CANCEL;
// }
// }
return NavigationActionPolicy.ALLOW;
},
return Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(top: false, bottom: true, child: _scaffold(context)),
)
: _scaffold(context);
}
onLoadStart: (controller, url) {
return setState(() {
isLoading = true;
});
},
onLoadStop: (controller, url) {
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onReceivedError: (controller, request, error) {
pullToRefreshController?.endRefreshing();
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
pullToRefreshController?.endRefreshing();
}
},
Widget _scaffold(BuildContext context) {
return Scaffold(
appBar: appbar(context, "ERP"),
body: Container(
child: Column(
children: <Widget>[
Expanded(
child: Stack(
children: [
InAppWebView(
initialUrlRequest: URLRequest(
url: WebUri(widget.url.toString()),
),
androidOnGeolocationPermissionsShowPrompt: (
InAppWebViewController controller,
String origin,
) async {
return GeolocationPermissionShowPromptResponse(
origin: origin,
allow: true,
retain: true,
);
},
initialOptions: InAppWebViewGroupOptions(
android: AndroidInAppWebViewOptions(
useWideViewPort: true,
loadWithOverviewMode: true,
allowContentAccess: true,
geolocationEnabled: true,
allowFileAccess: true,
databaseEnabled: true, // Enables the WebView database
domStorageEnabled: true, // Enables DOM storage
builtInZoomControls:
true, // Enables the built-in zoom controls
displayZoomControls:
false, // Disables displaying zoom controls
safeBrowsingEnabled: true, // Enables Safe Browsing
),
if (isLoading) ...[
Container(
color: Colors.white.withOpacity(0.7),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitRing(
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
allowsLinkPreview: true,
allowsBackForwardNavigationGestures: true,
),
),
androidOnPermissionRequest: (
InAppWebViewController controller,
String origin,
List<String> resources,
) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT,
);
},
initialSettings: InAppWebViewSettings(
javaScriptEnabled: true,
allowFileAccess: true,
allowContentAccess: true,
clearCache: true,
blockNetworkLoads: false,
networkAvailable: true,
useOnLoadResource: true,
thirdPartyCookiesEnabled: true,
supportZoom: false,
geolocationEnabled: true,
safeBrowsingEnabled: false,
saveFormData: true,
allowFileAccessFromFileURLs: true,
useWideViewPort: true,
databaseEnabled: true,
domStorageEnabled: true,
allowsBackForwardNavigationGestures: true,
allowUniversalAccessFromFileURLs: true,
allowsLinkPreview: true,
),
onPermissionRequest: (controller, request) async {
return PermissionResponse(
resources: request.resources,
action: PermissionResponseAction.GRANT,
);
},
keepAlive: InAppWebViewKeepAlive(),
// initialData:
// InAppWebViewInitialData(baseUrl: WebUri(widget.url),data: ),
onWebViewCreated: (controller) {
webViewController = controller;
_controller.complete(controller);
},
pullToRefreshController: pullToRefreshController,
shouldOverrideUrlLoading: (
controller,
navigationAction,
) async {
var uri = navigationAction.request.url!;
print("urib scgefes");
print(uri);
print(uri.scheme);
if (uri.scheme == "tel") {
// Launch the phone dialer app with the specified phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "mailto") {
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
} else if (uri.scheme == "whatsapp") {
// Launch WhatsApp with the specified chat or phone number
if (await canLaunch(uri.toString())) {
await launch(uri.toString());
return NavigationActionPolicy.CANCEL;
}
}
// // Check if the URL is trying to access the camera for image upload
// if (uri.scheme == 'camera' && uri.path.contains('/camera/')) {
// // Handle camera image upload here
// // You might want to display a custom UI for image selection or directly trigger the camera
// // You can use platform-specific plugins like image_picker for this purpose
// // Once the image is selected, you can pass it to the web view using JavaScript injection
// if (await canLaunch(uri.toString())) {
// await launch(uri.toString());
// return NavigationActionPolicy.CANCEL;
// }
// }
return NavigationActionPolicy.ALLOW;
},
onLoadStart: (controller, url) {
return setState(() {
isLoading = true;
});
},
onLoadStop: (controller, url) {
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onReceivedError: (controller, request, error) {
pullToRefreshController?.endRefreshing();
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
pullToRefreshController?.endRefreshing();
}
},
),
if (isLoading) ...[
Container(
color: Colors.white.withOpacity(0.7),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitRing(
color: AppColors.app_blue,
lineWidth: 4,
// duration: Duration(seconds: 2),
size: 50,
),
const SizedBox(height: 15),
SizedBox(
width: 200,
child: Text(
"Please wait.......",
textAlign: TextAlign.center,
style: TextStyle(
decorationThickness: 0,
fontSize: 15,
fontWeight: FontWeight.normal,
color: AppColors.app_blue,
lineWidth: 4,
// duration: Duration(seconds: 2),
size: 50,
),
const SizedBox(height: 15),
SizedBox(
width: 200,
child: Text(
"Please wait.......",
textAlign: TextAlign.center,
style: TextStyle(
decorationThickness: 0,
fontSize: 15,
fontWeight: FontWeight.normal,
color: AppColors.app_blue,
),
),
),
// SvgPicture.asset("/assets/images/NutsLoader.gif")
],
),
),
),
],
],
),
),
],
// SvgPicture.asset("/assets/images/NutsLoader.gif")
],
),
),
],
],
),
),
),
],
),
),
);
......
......@@ -16,13 +16,14 @@ import 'WebERPScreen.dart';
Future runErpScreenApp2() async {
await FlutterDownloader.initialize(
debug: true // optional: set false to disable printing logs to console
debug: true, // optional: set false to disable printing logs to console
);
await Permission.storage.request();
}
class WebWhizzdomScreen extends StatefulWidget {
final String whizzdom_url;
const WebWhizzdomScreen({super.key,required this.whizzdom_url});
const WebWhizzdomScreen({super.key, required this.whizzdom_url});
@override
State<WebWhizzdomScreen> createState() => _WebWhizzdomScreenState();
......@@ -30,7 +31,7 @@ class WebWhizzdomScreen extends StatefulWidget {
class _WebWhizzdomScreenState extends State<WebWhizzdomScreen> {
final Completer<InAppWebViewController> _controller =
Completer<InAppWebViewController>();
Completer<InAppWebViewController>();
var empId = "";
var sessionId = "";
bool isLoading = true;
......@@ -46,20 +47,23 @@ class _WebWhizzdomScreenState extends State<WebWhizzdomScreen> {
@override
void initState() {
// loadData();
pullToRefreshController = kIsWeb
? null
: PullToRefreshController(
settings: pullToRefreshSettings,
onRefresh: () async {
if (defaultTargetPlatform == TargetPlatform.android) {
webViewController?.reload();
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
webViewController?.loadUrl(
urlRequest:
URLRequest(url: await webViewController?.getUrl()));
}
},
);
pullToRefreshController =
kIsWeb
? null
: PullToRefreshController(
settings: pullToRefreshSettings,
onRefresh: () async {
if (defaultTargetPlatform == TargetPlatform.android) {
webViewController?.reload();
} else if (defaultTargetPlatform == TargetPlatform.iOS) {
webViewController?.loadUrl(
urlRequest: URLRequest(
url: await webViewController?.getUrl(),
),
);
}
},
);
// print("URL:${widget.url}");
super.initState();
}
......@@ -68,125 +72,134 @@ class _WebWhizzdomScreenState extends State<WebWhizzdomScreen> {
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
if (await webViewController!.canGoBack()) {
webViewController!.goBack();
return false; // Prevent default back button behavior
}
return true; // Allow default back button behavior
},
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Whizzdom"),
body: Container(
child: Column(children: <Widget>[
Expanded(
child: Stack(
children: [
InAppWebView(
initialUrlRequest: URLRequest(
url: WebUri(widget.whizzdom_url),
),
androidOnGeolocationPermissionsShowPrompt:
(InAppWebViewController controller, String origin) async {
return GeolocationPermissionShowPromptResponse(
origin: origin, allow: true, retain: true);
},
initialOptions: InAppWebViewGroupOptions(
android: AndroidInAppWebViewOptions(
useWideViewPort: true,
loadWithOverviewMode: true,
allowContentAccess: true,
geolocationEnabled: true,
allowFileAccess: true,
databaseEnabled: true, // Enables the WebView database
domStorageEnabled: true, // Enables DOM storage
builtInZoomControls:
true, // Enables the built-in zoom controls
displayZoomControls:
false, // Disables displaying zoom controls
safeBrowsingEnabled: true, // Enables Safe Browsing
clearSessionCache: true,
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
),
),
return Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(top: false, bottom: true, child: _scaffold(context)),
)
: _scaffold(context);
}
androidOnPermissionRequest: (InAppWebViewController controller,
String origin, List<String> resources) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT);
},
onWebViewCreated: (controller) {
webViewController = controller;
_controller.complete(controller);
},
pullToRefreshController: pullToRefreshController,
onLoadStart: (controller, url) {
return setState(() {
isLoading = true;
});
},
onLoadStop: (controller, url) {
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onReceivedError: (controller, request, error) {
pullToRefreshController?.endRefreshing();
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
pullToRefreshController?.endRefreshing();
}
},
Widget _scaffold(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Whizzdom"),
body: Container(
child: Column(
children: <Widget>[
Expanded(
child: Stack(
children: [
InAppWebView(
initialUrlRequest: URLRequest(
url: WebUri(widget.whizzdom_url),
),
androidOnGeolocationPermissionsShowPrompt: (
InAppWebViewController controller,
String origin,
) async {
return GeolocationPermissionShowPromptResponse(
origin: origin,
allow: true,
retain: true,
);
},
initialOptions: InAppWebViewGroupOptions(
android: AndroidInAppWebViewOptions(
useWideViewPort: true,
loadWithOverviewMode: true,
allowContentAccess: true,
geolocationEnabled: true,
allowFileAccess: true,
databaseEnabled: true, // Enables the WebView database
domStorageEnabled: true, // Enables DOM storage
builtInZoomControls:
true, // Enables the built-in zoom controls
displayZoomControls:
false, // Disables displaying zoom controls
safeBrowsingEnabled: true, // Enables Safe Browsing
clearSessionCache: true,
),
ios: IOSInAppWebViewOptions(
allowsInlineMediaPlayback: true,
),
),
),
if (isLoading) ...[Container(
color: Colors.white.withOpacity(0.7),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitRing(
androidOnPermissionRequest: (
InAppWebViewController controller,
String origin,
List<String> resources,
) async {
return PermissionRequestResponse(
resources: resources,
action: PermissionRequestResponseAction.GRANT,
);
},
onWebViewCreated: (controller) {
webViewController = controller;
_controller.complete(controller);
},
pullToRefreshController: pullToRefreshController,
onLoadStart: (controller, url) {
return setState(() {
isLoading = true;
});
},
onLoadStop: (controller, url) {
pullToRefreshController?.endRefreshing();
return setState(() {
isLoading = false;
});
},
onReceivedError: (controller, request, error) {
pullToRefreshController?.endRefreshing();
},
onProgressChanged: (controller, progress) {
if (progress == 100) {
pullToRefreshController?.endRefreshing();
}
},
),
if (isLoading) ...[
Container(
color: Colors.white.withOpacity(0.7),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitRing(
color: AppColors.app_blue,
lineWidth: 4,
// duration: Duration(seconds: 2),
size: 50,
),
const SizedBox(height: 15),
SizedBox(
width: 200,
child: Text(
"Please wait.......",
textAlign: TextAlign.center,
style: TextStyle(
decorationThickness: 0,
fontSize: 15,
fontWeight: FontWeight.normal,
color: AppColors.app_blue,
lineWidth: 4,
// duration: Duration(seconds: 2),
size: 50,
),
const SizedBox(
height: 15,
),
SizedBox(
width: 200,
child: Text(
"Please wait.......",
textAlign: TextAlign.center,
style: TextStyle(
decorationThickness: 0,
fontSize: 15,
fontWeight: FontWeight.normal,
color: AppColors.app_blue),
),
),
// SvgPicture.asset("/assets/images/NutsLoader.gif")
],
),
),
)]
],
))
])),
// SvgPicture.asset("/assets/images/NutsLoader.gif")
],
),
),
],
],
),
),
],
),
),
);
......
This diff is collapsed.
......@@ -29,175 +29,167 @@ class _FinancedashboardState extends State<Financedashboard> {
@override
Widget build(BuildContext context) {
return Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(top: false, bottom: true, child: _scaffold(context)),
)
: _scaffold(context);
}
Widget _scaffold(BuildContext context) {
return Consumer<Dashboardprovider>(
builder: (context, provider, child) {
final pages = provider.accessiblePagesList;
return WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "Finance"),
body: SizedBox(
child: SingleChildScrollView(
child: Column(
children: [
ListView.builder(
itemCount: pages.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
Widget? SvgIcon;
switch (pages[index].mode) {
case "apr_lvl1":
SvgIcon = SvgPicture.asset(
"assets/svg/fin_lv1.svg",
);
break;
case "apr_lvl2":
SvgIcon = SvgPicture.asset(
"assets/svg/fin_lv2.svg",
);
break;
final icons = ["comm_ic_1", "comm_ic_2"];
default:
SvgIcon = SvgPicture.asset(
"assets/svg/fin_ic.svg",
);
break;
}
return InkResponse(
onTap: () async {
var navigate;
if (pages[index].pageName == "Payments List") {
navigate = Paymentlistpaymentrequisition(
pageTitleName:
provider
.accessiblePagesList[index]
.pageName!,
);
} else if (provider
.accessiblePagesList[index]
.pageName ==
"Payment Receipts List") {
navigate = Paymentreceiptlist(
pageTitleName:
provider
.accessiblePagesList[index]
.pageName!,
);
} else if (provider
.accessiblePagesList[index]
.pageName ==
"Account List") {
navigate = Accountslist();
return Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "Finance"),
body: SizedBox(
child: SingleChildScrollView(
child: Column(
children: [
ListView.builder(
itemCount: pages.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
Widget? SvgIcon;
switch (pages[index].mode) {
case "apr_lvl1":
SvgIcon = SvgPicture.asset("assets/svg/fin_lv1.svg");
break;
case "apr_lvl2":
SvgIcon = SvgPicture.asset("assets/svg/fin_lv2.svg");
break;
final icons = ["comm_ic_1", "comm_ic_2"];
default:
SvgIcon = SvgPicture.asset("assets/svg/fin_ic.svg");
break;
}
return InkResponse(
onTap: () async {
var navigate;
if (pages[index].pageName == "Payments List") {
navigate = Paymentlistpaymentrequisition(
pageTitleName:
provider.accessiblePagesList[index].pageName!,
);
} else if (provider
.accessiblePagesList[index]
.pageName ==
"Payment Receipts List") {
navigate = Paymentreceiptlist(
pageTitleName:
provider.accessiblePagesList[index].pageName!,
);
} else if (provider
.accessiblePagesList[index]
.pageName ==
"Account List") {
navigate = Accountslist();
// break;
} else if (provider
// break;
} else if (provider
.accessiblePagesList[index]
.pageName ==
"Account Ledger") {
navigate = Accountledger();
} else {
navigate = Allpaymentrequesitionlistsbymodes(
mode: pages[index].mode!,
pageTitleName:
provider.accessiblePagesList[index].pageName!,
);
}
await Navigator.push(
context,
MaterialPageRoute(builder: (context) => navigate),
);
},
child: Container(
margin: EdgeInsets.symmetric(
horizontal: 5,
vertical: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(14),
),
child: Row(
children: [
if (provider
.accessiblePagesList[index]
.pageName ==
"Account Ledger") {
navigate = Accountledger();
} else {
navigate = Allpaymentrequesitionlistsbymodes(
mode: pages[index].mode!,
pageTitleName:
provider
.accessiblePagesList[index]
.pageName!,
);
}
await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => navigate,
"Account List") ...[
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/comm_ic_1.svg",
width: 25,
),
),
);
},
child: Container(
margin: EdgeInsets.symmetric(
horizontal: 5,
vertical: 5,
),
padding: EdgeInsets.symmetric(
horizontal: 10,
vertical: 15,
),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(14),
),
child: Row(
children: [
if(provider
] else if (provider
.accessiblePagesList[index]
.pageName ==
"Account List")...[
Expanded(flex: 1,
child: SvgPicture.asset(
"assets/svg/comm_ic_1.svg",width: 25,
),
)
]else if(provider
.accessiblePagesList[index]
.pageName ==
"Account Ledger")...[
Expanded(flex: 1,
child: SvgPicture.asset(
"assets/svg/comm_ic_2.svg",width: 25,
),
)
]else...[
Expanded(flex: 1, child: SvgIcon),
],
Expanded(
flex: 5,
child: Text("${pages[index].pageName}"),
),
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/arrow_right_new.svg",
),
"Account Ledger") ...[
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/comm_ic_2.svg",
width: 25,
),
],
),
] else ...[
Expanded(flex: 1, child: SvgIcon),
],
Expanded(
flex: 5,
child: Text("${pages[index].pageName}"),
),
),
);
},
),
SizedBox(height: 150,)
],
Expanded(
flex: 1,
child: SvgPicture.asset(
"assets/svg/arrow_right_new.svg",
),
),
],
),
),
);
},
),
),
SizedBox(height: 150),
],
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
floatingActionButton: InkResponse(
onTap: () {
_showPaymentOptionsSheet(context);
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child: Text(
"Add",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerFloat,
floatingActionButton: InkResponse(
onTap: () {
_showPaymentOptionsSheet(context);
},
child: Container(
height: 45,
alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 10),
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
decoration: BoxDecoration(
color: AppColors.app_blue,
borderRadius: BorderRadius.circular(15),
),
child: Text(
"Add",
style: TextStyle(
fontSize: 15,
fontFamily: "JakartaMedium",
color: Colors.white,
),
),
),
......@@ -295,14 +287,16 @@ class _FinancedashboardState extends State<Financedashboard> {
),
);
} else if (provider
.accessiblePagesList2[index]
.pageName!.contains("Add Account")) {
.accessiblePagesList2[index]
.pageName!
.contains("Add Account")) {
res = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Addcommonpayment(
from: "Dashboard",
),
builder:
(context) => Addcommonpayment(
from: "Dashboard",
),
),
);
} else {
......
......@@ -17,6 +17,15 @@ class Gentrackerdashboard extends StatefulWidget {
class _GentrackerdashboardState extends State<Gentrackerdashboard> {
@override
Widget build(BuildContext context) {
return Platform.isAndroid
? WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(top: false, bottom: true, child: _scaffold(context)),
)
: _scaffold(context);
}
Widget _scaffold(BuildContext context) {
final names = [
"Generator Details",
// "Register Complaint",
......@@ -29,117 +38,109 @@ class _GentrackerdashboardState extends State<Gentrackerdashboard> {
// "gent_tag_loc",
"gent_tag_den",
];
return WillPopScope(
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
child: Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "Gen Tracker"),
body: Column(
children: [
Expanded(
flex: 1,
child: GridView.builder(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
itemCount: names.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
),
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return InkResponse(
onTap: () {
switch (names[index]) {
case "Generator Details":
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Scanentergeneratoridscreen(
from: "Generator Details",
),
),
);
break;
case "Register Complaint":
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Scanentergeneratoridscreen(
from: "Register Complaint",
),
),
);
break;
case "Tag Location":
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Scanentergeneratoridscreen(
from: "Tag Location",
),
),
);
break;
case "Tag Generator":
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Scanentergeneratoridscreen(
from: "Tag Generator",
),
),
);
break;
return Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: AppColors.scaffold_bg_color,
appBar: appbar(context, "Gen Tracker"),
body: Column(
children: [
Expanded(
flex: 1,
child: GridView.builder(
padding: EdgeInsets.symmetric(vertical: 10, horizontal: 10),
itemCount: names.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
),
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, index) {
return InkResponse(
onTap: () {
switch (names[index]) {
case "Generator Details":
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Scanentergeneratoridscreen(
from: "Generator Details",
),
),
);
break;
case "Register Complaint":
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Scanentergeneratoridscreen(
from: "Register Complaint",
),
),
);
break;
case "Tag Location":
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Scanentergeneratoridscreen(
from: "Tag Location",
),
),
);
break;
case "Tag Generator":
Navigator.push(
context,
MaterialPageRoute(
builder:
(context) => Scanentergeneratoridscreen(
from: "Tag Generator",
),
),
);
break;
default:
print("111");
break;
}
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(30),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset("assets/svg/${icons[index]}.svg"),
SizedBox(height: 10),
Text(names[index]),
],
),
),
);
default:
print("111");
break;
}
},
),
),
SizedBox(height: 10),
Expanded(
flex: 3,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Note: 'Tag Location' and 'Register Complaint' are moved to 'Generator Details'.",
style: TextStyle(color: AppColors.grey_thick,
fontSize: 14),
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(30),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SvgPicture.asset("assets/svg/${icons[index]}.svg"),
SizedBox(height: 10),
Text(names[index]),
],
),
),
),
);
},
),
),
SizedBox(height: 10),
Expanded(
flex: 3,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Note: 'Tag Location' and 'Register Complaint' are moved to 'Generator Details'.",
style: TextStyle(color: AppColors.grey_thick, fontSize: 14),
),
SizedBox(height: 10),
],
),
),
),
SizedBox(height: 10),
],
),
);
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -27,7 +27,7 @@ class _AccountsuggestionsState extends State<Accountsuggestions> {
onWillPop: () => onBackPressed(context),
child: SafeArea(
top: false,
bottom: Platform.isIOS?false:true,
bottom: Platform.isIOS ? false : true,
child: Scaffold(
resizeToAvoidBottomInset: true,
appBar: appbar(context, "Accounts"),
......@@ -54,7 +54,10 @@ class _AccountsuggestionsState extends State<Accountsuggestions> {
borderRadius: BorderRadius.circular(14),
border:
searchFocusNode.hasFocus
? Border.all(color: AppColors.app_blue, width: 0.5)
? Border.all(
color: AppColors.app_blue,
width: 0.5,
)
: null,
),
// alignment: Alignment.center,
......@@ -123,7 +126,9 @@ class _AccountsuggestionsState extends State<Accountsuggestions> {
builder:
(context) => Paymentdetails(
accountName: "Account",
name: accountList![index].accountName,
name:
accountList![index]
.accountName,
genId: "",
referenceID:
accountList![index].accountId,
......@@ -135,7 +140,8 @@ class _AccountsuggestionsState extends State<Accountsuggestions> {
child: SizedBox(
child: Container(
width:
MediaQuery.of(context).size.width * 0.9,
MediaQuery.of(context).size.width *
0.9,
padding: EdgeInsets.fromLTRB(0, 5, 0, 10),
child: Row(
children: [
......@@ -148,9 +154,8 @@ class _AccountsuggestionsState extends State<Accountsuggestions> {
),
decoration: BoxDecoration(
color: Color(0xFFE6F6FF),
borderRadius: BorderRadius.circular(
8,
),
borderRadius:
BorderRadius.circular(8),
),
child: SvgPicture.asset(
width: 30,
......@@ -159,7 +164,7 @@ class _AccountsuggestionsState extends State<Accountsuggestions> {
),
),
),
SizedBox(width: 10,),
SizedBox(width: 10),
Expanded(
flex: 5,
child: Text(
......@@ -168,7 +173,7 @@ class _AccountsuggestionsState extends State<Accountsuggestions> {
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: AppColors.semi_black
color: AppColors.semi_black,
),
),
),
......@@ -189,7 +194,8 @@ class _AccountsuggestionsState extends State<Accountsuggestions> {
physics: AlwaysScrollableScrollPhysics(),
child: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height,
height:
MediaQuery.of(context).size.height,
// Set width to fill parent width
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
......@@ -197,7 +203,12 @@ class _AccountsuggestionsState extends State<Accountsuggestions> {
topRight: Radius.circular(30.0),
),
),
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
padding: EdgeInsets.fromLTRB(
10,
10,
10,
10,
),
child: Container(
child: Align(
alignment: Alignment.center,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment