mirror of
https://github.com/Cateners/tiny_computer.git
synced 2026-05-20 16:35:47 +08:00
Merge pull request #9 from wyq0918dev/md3
Modify user interface to material3
This commit is contained in:
@@ -25,6 +25,7 @@ import 'dart:math';
|
|||||||
//import 'package:flutter/services.dart';
|
//import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'package:clipboard/clipboard.dart';
|
import 'package:clipboard/clipboard.dart';
|
||||||
|
import 'package:dynamic_color/dynamic_color.dart';
|
||||||
import 'package:flutter/gestures.dart';
|
import 'package:flutter/gestures.dart';
|
||||||
import 'package:flutter_pty/flutter_pty.dart';
|
import 'package:flutter_pty/flutter_pty.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
@@ -49,14 +50,23 @@ class MyApp extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return DynamicColorBuilder(
|
||||||
title: 'Tiny Computer',
|
builder: (ColorScheme? lightDynamic, ColorScheme? darkDynamic) {
|
||||||
theme: ThemeData(
|
return MaterialApp(
|
||||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
|
title: 'Tiny Computer',
|
||||||
useMaterial3: true,
|
theme: ThemeData(
|
||||||
//fontFamily: "FiraCode",
|
colorScheme: lightDynamic,
|
||||||
),
|
useMaterial3: true,
|
||||||
home: const MyHomePage(title: 'Tiny Computer'),
|
//fontFamily: "FiraCode",
|
||||||
|
),
|
||||||
|
darkTheme: ThemeData(
|
||||||
|
colorScheme: darkDynamic,
|
||||||
|
useMaterial3: true,
|
||||||
|
//fontFamily: "FiraCode",
|
||||||
|
),
|
||||||
|
home: const MyHomePage(title: 'Tiny Computer'),
|
||||||
|
);
|
||||||
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1516,7 +1526,6 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
|
|
||||||
title: Text(isLoadingComplete?Util.getCurrentProp("name"):widget.title),
|
title: Text(isLoadingComplete?Util.getCurrentProp("name"):widget.title),
|
||||||
),
|
),
|
||||||
body: isLoadingComplete?Column(mainAxisSize: MainAxisSize.min, children: [
|
body: isLoadingComplete?Column(mainAxisSize: MainAxisSize.min, children: [
|
||||||
@@ -1564,15 +1573,25 @@ class _MyHomePageState extends State<MyHomePage> {
|
|||||||
}))]):const LoadingPage(),
|
}))]):const LoadingPage(),
|
||||||
bottomNavigationBar: ValueListenableBuilder(valueListenable: G.pageIndex, builder:(context, value, child) {
|
bottomNavigationBar: ValueListenableBuilder(valueListenable: G.pageIndex, builder:(context, value, child) {
|
||||||
return Visibility(visible: isLoadingComplete,
|
return Visibility(visible: isLoadingComplete,
|
||||||
child: BottomNavigationBar(currentIndex: G.pageIndex.value,
|
// child: BottomNavigationBar(currentIndex: G.pageIndex.value,
|
||||||
onTap: (index) {
|
// onTap: (index) {
|
||||||
|
// G.pageIndex.value = index;
|
||||||
|
// },
|
||||||
|
// items: const [
|
||||||
|
// BottomNavigationBarItem(icon: Icon(Icons.monitor), label: "终端"),
|
||||||
|
// BottomNavigationBarItem(icon: Icon(Icons.video_settings), label: "控制"),
|
||||||
|
// ],
|
||||||
|
// )
|
||||||
|
child: NavigationBar(
|
||||||
|
selectedIndex: G.pageIndex.value,
|
||||||
|
destinations: const [
|
||||||
|
NavigationDestination(icon: Icon(Icons.monitor), label: "终端"),
|
||||||
|
NavigationDestination(icon: Icon(Icons.video_settings), label: "控制")
|
||||||
|
],
|
||||||
|
onDestinationSelected: (index) {
|
||||||
G.pageIndex.value = index;
|
G.pageIndex.value = index;
|
||||||
},
|
},
|
||||||
items: const [
|
),
|
||||||
BottomNavigationBarItem(icon: Icon(Icons.monitor), label: "终端"),
|
|
||||||
BottomNavigationBarItem(icon: Icon(Icons.video_settings), label: "控制"),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
);}),
|
);}),
|
||||||
floatingActionButton: ValueListenableBuilder(valueListenable: G.pageIndex, builder:(context, value, child) {
|
floatingActionButton: ValueListenableBuilder(valueListenable: G.pageIndex, builder:(context, value, child) {
|
||||||
return Visibility(visible: isLoadingComplete && (value == 0),
|
return Visibility(visible: isLoadingComplete && (value == 0),
|
||||||
|
|||||||
@@ -73,6 +73,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.10"
|
version: "0.7.10"
|
||||||
|
dynamic_color:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: dynamic_color
|
||||||
|
sha256: a866f1f8947bfdaf674d7928e769eac7230388a2e7a2542824fad4bb5b87be3b
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.6.9"
|
||||||
equatable:
|
equatable:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ dependencies:
|
|||||||
clipboard: ^0.1.3
|
clipboard: ^0.1.3
|
||||||
ffmpeg_kit_flutter_full_gpl: ^6.0.3
|
ffmpeg_kit_flutter_full_gpl: ^6.0.3
|
||||||
wakelock_plus: ^1.1.4
|
wakelock_plus: ^1.1.4
|
||||||
|
dynamic_color: ^1.6.9
|
||||||
|
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
|
|||||||
Reference in New Issue
Block a user