|
|
|
|
@ -26,6 +26,7 @@ import 'package:mohem_flutter_app/models/privilege_list_model.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/button/default_button.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/widgets/input_widget.dart';
|
|
|
|
|
import 'package:safe_device/safe_device.dart';
|
|
|
|
|
import 'package:wifi_iot/wifi_iot.dart';
|
|
|
|
|
|
|
|
|
|
class LoginScreen extends StatefulWidget {
|
|
|
|
|
LoginScreen({Key? key}) : super(key: key);
|
|
|
|
|
@ -160,8 +161,8 @@ class _LoginScreenState extends State<LoginScreen> {
|
|
|
|
|
isAppOpenBySystem = (ModalRoute.of(context)!.settings.arguments ?? true) as bool;
|
|
|
|
|
if (!kReleaseMode) {
|
|
|
|
|
// username.text = "15444"; // Maha User
|
|
|
|
|
// username.text = "15153"; // Tamer User
|
|
|
|
|
// password.text = "Abcd@1234";
|
|
|
|
|
username.text = "15153"; // Tamer User
|
|
|
|
|
password.text = "Abcd@12345";
|
|
|
|
|
|
|
|
|
|
// username.text = "206535"; // Hashim User
|
|
|
|
|
// password.text = "Namira786";
|
|
|
|
|
@ -224,6 +225,14 @@ class _LoginScreenState extends State<LoginScreen> {
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.forgotPassword);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
20.height,
|
|
|
|
|
DefaultButton(
|
|
|
|
|
"Connect HMG Network",
|
|
|
|
|
() async {
|
|
|
|
|
SystemChannels.textInput.invokeMethod('TextInput.hide');
|
|
|
|
|
connectWithHmgNetwork();
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
)
|
|
|
|
|
@ -239,4 +248,30 @@ class _LoginScreenState extends State<LoginScreen> {
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void connectWithHmgNetwork() async {
|
|
|
|
|
try {
|
|
|
|
|
bool isConnected = await WiFiForIoTPlugin.connect("MOHEMM-CONNECT", password: "0987654321", joinOnce: Platform.isIOS ? false : true, security: NetworkSecurity.WPA, withInternet: false);
|
|
|
|
|
|
|
|
|
|
if (isConnected) {
|
|
|
|
|
await WiFiForIoTPlugin.forceWifiUsage(true);
|
|
|
|
|
// if (Platform.isIOS) {
|
|
|
|
|
// await closeWifiRequest();
|
|
|
|
|
// await Future.delayed(Duration(seconds: 6));
|
|
|
|
|
// } else {
|
|
|
|
|
// await WiFiForIoTPlugin.forceWifiUsage(true);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
print("----------------o----");
|
|
|
|
|
print(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool> closeWifiRequest() async {
|
|
|
|
|
if (Platform.isAndroid) {
|
|
|
|
|
await WiFiForIoTPlugin.forceWifiUsage(false);
|
|
|
|
|
}
|
|
|
|
|
return await WiFiForIoTPlugin.disconnect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|