Skip to content

Commit

Permalink
resolve screenreset issues (#41)
Browse files Browse the repository at this point in the history
* resolve screenreset issues in mobile screen

* change hintText in textformfield

* Don't show success message twice

* simplify toggle switch logic

---------

Co-authored-by: Muzzammil Shahid <[email protected]>
  • Loading branch information
shakeebkhan66 and muzzammilshahid authored Jun 6, 2024
1 parent 3d40073 commit 87afa91
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 24 deletions.
17 changes: 6 additions & 11 deletions lib/screens/mobile/mobile_home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,16 +244,9 @@ class _MobileHomeScaffoldState extends State<MobileHomeScaffold> with TickerProv
scaffoldMessenger.showSnackBar(SnackBar(content: Text("An error occurred. Please try again. $e")));
}

if (!routerResult.isServerStarted) {
scaffoldMessenger.showSnackBar(
const SnackBar(
content: Text("Failed to start the server."),
duration: Duration(seconds: 3),
),
);
return;
if (routerResult.isServerStarted) {
routerResult.toggleSwitch(value: true);
}
routerResult.toggleSwitch(value: true);
}

Future<void> _showCloseRouterDialog(
Expand All @@ -267,11 +260,10 @@ class _MobileHomeScaffoldState extends State<MobileHomeScaffold> with TickerProv
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text(
title: const Text(
"Router Connection",
style: TextStyle(
fontWeight: FontWeight.w700,
color: homeAppBarTextColor,
fontSize: iconSize,
),
),
Expand Down Expand Up @@ -408,6 +400,7 @@ class _MobileHomeScaffoldState extends State<MobileHomeScaffold> with TickerProv
controller: _tabData[index].linkController,
decoration: const InputDecoration(
hintText: "ws://localhost:8080/ws",
hintStyle: TextStyle(fontWeight: FontWeight.w200),
labelText: "Enter URL here",
border: InputBorder.none,
contentPadding: EdgeInsets.all(10),
Expand Down Expand Up @@ -454,6 +447,7 @@ class _MobileHomeScaffoldState extends State<MobileHomeScaffold> with TickerProv
controller: _tabData[index].realmController,
decoration: InputDecoration(
hintText: "Enter realm here",
hintStyle: const TextStyle(fontWeight: FontWeight.w200),
labelText: "Enter realm here",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
Expand Down Expand Up @@ -887,6 +881,7 @@ class _MobileHomeScaffoldState extends State<MobileHomeScaffold> with TickerProv
hintText: sendButtonText.contains("Publish") || sendButtonText.contains("Subscribe")
? "Enter topic here"
: "Enter procedure here",
hintStyle: const TextStyle(fontWeight: FontWeight.w200),
labelText: sendButtonText.contains("Publish") || sendButtonText.contains("Subscribe")
? "Enter topic here"
: "Enter procedure here",
Expand Down
13 changes: 0 additions & 13 deletions lib/screens/mobile/router_dialogbox.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import "package:wick_ui/constants.dart";
import "package:wick_ui/providers/router_realm_provider.dart";
import "package:wick_ui/providers/router_state_provider.dart";
import "package:wick_ui/providers/router_toggleswitch_provider.dart";
import "package:wick_ui/screens/mobile/mobile_home.dart";
import "package:wick_ui/wamp_util.dart";

class RouterDialogBox extends StatefulWidget {
Expand Down Expand Up @@ -222,23 +221,11 @@ class _RouterDialogBoxState extends State<RouterDialogBox> {
const Duration(milliseconds: 500),
onTimeout: () {
Navigator.pop(context);
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => const MobileHomeScaffold()),
);
throw TimeoutException("Server is running on this host localhost: $host and on this port $port");
},
);

realmProvider.resetControllers();
scaffoldMessenger.showSnackBar(
SnackBar(
content: Text(
"Server is running on this host localhost: $host and on this port $port",
),
duration: const Duration(seconds: 3),
),
);
} on TimeoutException catch (_) {
scaffoldMessenger.showSnackBar(
SnackBar(
Expand Down

0 comments on commit 87afa91

Please sign in to comment.