pretty cool
This commit is contained in:
parent
b42081b525
commit
40bad1e06e
7 changed files with 539 additions and 53 deletions
107
lib/main.dart
107
lib/main.dart
|
|
@ -1,8 +1,10 @@
|
|||
import "dart:io";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:nexus/widgets/room_chat.dart";
|
||||
import "package:nexus/widgets/sidebar.dart";
|
||||
import "package:window_manager/window_manager.dart";
|
||||
import "package:flutter/material.dart";
|
||||
import "package:dynamic_system_colors/dynamic_system_colors.dart";
|
||||
import "package:flutter_hooks/flutter_hooks.dart";
|
||||
import "package:window_size/window_size.dart";
|
||||
|
||||
void main() async {
|
||||
|
|
@ -15,65 +17,66 @@ void main() async {
|
|||
|
||||
setWindowMinSize(const Size.square(500));
|
||||
|
||||
runApp(const App());
|
||||
runApp(ProviderScope(child: const App()));
|
||||
}
|
||||
|
||||
class App extends HookWidget {
|
||||
class App extends StatelessWidget {
|
||||
const App({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final index = useState(0);
|
||||
final drawer = Drawer(
|
||||
child: Row(
|
||||
children: [
|
||||
NavigationRail(
|
||||
useIndicator: false,
|
||||
labelType: NavigationRailLabelType.none,
|
||||
onDestinationSelected: (value) => index.value = value,
|
||||
destinations: [
|
||||
NavigationRailDestination(
|
||||
icon: Icon(Icons.home),
|
||||
label: Text("Home"),
|
||||
padding: EdgeInsets.symmetric(vertical: 8),
|
||||
),
|
||||
NavigationRailDestination(
|
||||
icon: Image.file(File("assets/icon.png"), width: 35),
|
||||
label: Text("Space 1"),
|
||||
),
|
||||
],
|
||||
selectedIndex: index.value,
|
||||
Widget build(BuildContext context) => DynamicColorBuilder(
|
||||
builder: (lightDynamic, darkDynamic) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final isDesktop = constraints.maxWidth > 650;
|
||||
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData.from(
|
||||
colorScheme:
|
||||
lightDynamic ?? ColorScheme.fromSeed(seedColor: Colors.indigo),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
return DynamicColorBuilder(
|
||||
builder: (lightDynamic, darkDynamic) => LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final isDesktop = constraints.maxWidth > 650;
|
||||
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData.from(
|
||||
colorScheme: lightDynamic ?? ColorScheme.light(),
|
||||
),
|
||||
darkTheme: ThemeData.from(
|
||||
colorScheme: darkDynamic ?? ColorScheme.dark(),
|
||||
),
|
||||
home: Scaffold(
|
||||
appBar: isDesktop ? null : AppBar(),
|
||||
body: Row(
|
||||
darkTheme: ThemeData.from(
|
||||
colorScheme:
|
||||
darkDynamic ??
|
||||
ColorScheme.fromSeed(
|
||||
seedColor: Colors.indigo,
|
||||
brightness: Brightness.dark,
|
||||
),
|
||||
),
|
||||
home: Scaffold(
|
||||
body: Builder(
|
||||
builder: (context) => Row(
|
||||
children: [
|
||||
if (isDesktop) drawer,
|
||||
Expanded(child: Column()),
|
||||
if (isDesktop) Sidebar(),
|
||||
Expanded(
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: isDesktop
|
||||
? null
|
||||
: DrawerButton(
|
||||
onPressed: () =>
|
||||
Scaffold.of(context).openDrawer(),
|
||||
),
|
||||
actionsPadding: EdgeInsets.symmetric(horizontal: 8),
|
||||
title: Text("Some Chat Name"),
|
||||
actions: [
|
||||
if (!(Platform.isAndroid || Platform.isIOS))
|
||||
IconButton(
|
||||
onPressed: () => exit(0),
|
||||
icon: Icon(Icons.close),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: RoomChat(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
drawer: isDesktop ? null : drawer,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
drawer: isDesktop ? null : Sidebar(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue