Skip to content

Commit

Permalink
Custom MJPEG implementation and added swipe for next printer
Browse files Browse the repository at this point in the history
  • Loading branch information
Clon1998 committed Mar 31, 2022
1 parent ea7051a commit 99afe49
Show file tree
Hide file tree
Showing 14 changed files with 521 additions and 112 deletions.
17 changes: 12 additions & 5 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,18 @@
}
}
},
"nav_drawer": {
"printer_settings": "Printer Settings",
"manage_printers": "Manager Printers",
"fetching_printers": "@:general.fetching printers...",
"footer": "Made with ❤️ by Patrick Schmidt\nCheckout the project's"
"components": {
"nav_drawer": {
"printer_settings": "Printer Settings",
"manage_printers": "Manager Printers",
"fetching_printers": "@:general.fetching printers...",
"footer": "Made with ❤️ by Patrick Schmidt\nCheckout the project's"
},
"connection_watcher": {
"reconnect": "Reconnect",
"trying_connect": "Trying to connect ...",
"server_starting": "Server is starting..."
}
},
"klipper_state": {
"ready": "Ready",
Expand Down
19 changes: 9 additions & 10 deletions lib/ui/components/connection/connection_state_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,26 @@ class ConnectionStateView
SizedBox(
height: 30,
),
Text("Disconnected!"),
Text('@:klipper_state.disconnected !').tr(),
TextButton.icon(
onPressed: model.onRetryPressed,
icon: Icon(Icons.stream),
label: Text("Reconnect"))
icon: Icon(Icons.restart_alt_outlined),
label: Text('components.connection_watcher.reconnect').tr())
],
),
);
case WebSocketState.connecting:
return Center(
key: UniqueKey(),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SpinKitPouringHourGlassRefined(
color: Theme.of(context).colorScheme.secondary,
SpinKitPulse(
color: Theme.of(context).colorScheme.primary,
),
SizedBox(
height: 30,
),
FadingText("Trying to connect ..."),
FadingText(tr('components.connection_watcher.trying_connect')),
],
),
);
Expand All @@ -120,8 +119,8 @@ class ConnectionStateView
),
TextButton.icon(
onPressed: model.onRetryPressed,
icon: Icon(Icons.stream),
label: Text("Reconnect!!"))
icon: Icon(Icons.restart_alt_outlined),
label: Text('components.connection_watcher.reconnect').tr())
],
),
);
Expand Down Expand Up @@ -193,7 +192,7 @@ class ConnectionStateView
),
title: Text(model.klippyState),
),
Text('Server is starting...')
Text('components.connection_watcher.server_starting').tr()
],
),
)),
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/components/dialog/editForm/range_edit_form_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import 'package:stacked_services/stacked_services.dart';

class NumberEditDialogArguments {
final num min;
final num max;
final num? max;
final num current;
final int fraction;

NumberEditDialogArguments(
{this.min = 0, this.max = 100, required this.current, this.fraction = 0});
{this.min = 0, this.max, required this.current, this.fraction = 0});
}

class RangeEditFormDialogView extends StatelessWidget {
Expand Down Expand Up @@ -46,7 +46,7 @@ class RangeEditFormDialogView extends StatelessWidget {
initialValue:
data.current.toDouble().toPrecision(data.fraction),
min: data.min.toDouble(),
max: data.max.toDouble(),
max: (data.max?? 100).toDouble(),
// divisions: (data.max + data.min.abs()).toInt(),
autofocus: true,
numberFormat: NumberFormat("####"),
Expand Down
8 changes: 4 additions & 4 deletions lib/ui/components/drawer/nav_drawer_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class NavigationDrawerWidget
children: [
ExpansionTile(
title: const Text(
'nav_drawer.manage_printers',
'components.nav_drawer.manage_printers',
style: TextStyle(color: Colors.white),
).tr(),
children: [
Expand Down Expand Up @@ -94,7 +94,7 @@ class NavigationDrawerWidget
alignment: Alignment.center,
padding: EdgeInsets.only(bottom: 20, top: 10),
child: RichText(
text: TextSpan(text: 'nav_drawer.footer'.tr(), children: [
text: TextSpan(text: 'components.nav_drawer.footer'.tr(), children: [
new TextSpan(
text: ' GitHub ',
style: new TextStyle(color: Colors.blue),
Expand Down Expand Up @@ -153,7 +153,7 @@ class NavigationDrawerWidget
} else {
widgetsToReturn = [
ListTile(
title: FadingText('nav_drawer.fetching_printers'.tr()),
title: FadingText('components.nav_drawer.fetching_printers'.tr()),
contentPadding: const EdgeInsets.only(left: 32, right: 16),
),
];
Expand Down Expand Up @@ -208,7 +208,7 @@ class NavigationDrawerWidget
),
IconButton(
onPressed: onClicked,
tooltip: 'nav_drawer.printer_settings'.tr(),
tooltip: 'components.nav_drawer.printer_settings'.tr(),
icon: Icon(
FlutterIcons.settings_fea,
color: Colors.white,
Expand Down

0 comments on commit 99afe49

Please sign in to comment.