Skip to content
This repository has been archived by the owner on Sep 27, 2024. It is now read-only.

Commit

Permalink
feat: init desktop view
Browse files Browse the repository at this point in the history
  • Loading branch information
RossComputerGuy committed Apr 30, 2024
1 parent 18afd74 commit fe356ac
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
9 changes: 7 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import 'package:flutter/material.dart';
import 'package:system_theme/system_theme.dart';

import 'logic/theme.dart' show buildThemeData;
import 'views/system/lock.dart';
import 'views/desktop.dart';
import 'views/lock.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand Down Expand Up @@ -37,7 +38,11 @@ class MyApp extends StatelessWidget {
brightness: Brightness.dark,
),
themeMode: ThemeMode.dark,
home: const SystemLockView(),
routes: {
'/': (_) => const DesktopView(),
'/lock': (_) => const LockView(),
},
initialRoute: '/lock',
),
);
}
Expand Down
18 changes: 18 additions & 0 deletions lib/views/desktop.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:flutter/material.dart';

import '../../widgets/system_layout.dart';

class DesktopView extends StatefulWidget {
const DesktopView({ super.key });

@override
State<DesktopView> createState() => _DesktopViewState();
}

class _DesktopViewState extends State<DesktopView> {
@override
Widget build(BuildContext context) =>
SystemLayout(
body: Container(),
);
}
18 changes: 10 additions & 8 deletions lib/views/system/lock.dart → lib/views/lock.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@ import '../../widgets/draggable.dart';
import '../../widgets/keypad.dart';
import '../../widgets/system_layout.dart';

class SystemLockView extends StatefulWidget {
const SystemLockView({ super.key });
class LockView extends StatefulWidget {
const LockView({ super.key });

@override
State<SystemLockView> createState() => _SystemLockViewState();
State<LockView> createState() => _LockViewState();
}

class _SystemLockViewState extends State<SystemLockView> {
class _LockViewState extends State<LockView> {
static const platform = MethodChannel('com.expidusos.genesis.shell/auth');

TextEditingController passcodeController = TextEditingController();
String? errorText = null;

void _onSubmitted(String input) {
void _onSubmitted(BuildContext context, String input) {
setState(() {
errorText = null;
});
Expand All @@ -34,7 +34,9 @@ class _SystemLockViewState extends State<SystemLockView> {
errorText = null;
});

// TODO: jump to desktop
final nav = Navigator.of(context);
if (nav.canPop()) nav.pop();
else nav.pushReplacementNamed('/');
}).catchError((err) => setState(() {
if (err is PlatformException) {
errorText = '${err.code}: ${err.message}: ${err.details.toString()}';
Expand Down Expand Up @@ -127,7 +129,7 @@ class _SystemLockViewState extends State<SystemLockView> {
errorText: errorText,
),
style: Theme.of(context).textTheme.displayMedium,
onSubmitted: _onSubmitted,
onSubmitted: (input) => _onSubmitted(context, input),
),
),
Keypad(
Expand All @@ -145,7 +147,7 @@ class _SystemLockViewState extends State<SystemLockView> {
}
});
} else if (icon == Icons.keyboard_return) {
_onSubmitted(passcodeController.text);
_onSubmitted(context, passcodeController.text);
}
},
),
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/system_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class SystemBar extends StatelessWidget implements PreferredSizeWidget {
@override
Widget build(BuildContext context) =>
AppBar(
automaticallyImplyLeading: false,
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
actions: [
Scaffold.of(context).hasEndDrawer ?
Expand Down

0 comments on commit fe356ac

Please sign in to comment.