Skip to content

Commit

Permalink
清理
Browse files Browse the repository at this point in the history
  • Loading branch information
chen56 committed Apr 26, 2024
1 parent 0f90771 commit 16ad32e
Show file tree
Hide file tree
Showing 10 changed files with 99 additions and 450 deletions.
31 changes: 31 additions & 0 deletions notes/flutter_web/lib/app.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// part of "pages.g.dart";
import 'package:flutter/material.dart';
import 'package:flutter_web/routes.g.dart';
import 'package:you_flutter/better_ui.dart';
import 'package:you_flutter/router.dart';
import 'package:you_note_dart/note.dart';
import 'package:shared_preferences/shared_preferences.dart';

final YouRouter router = YouRouter(
root: root,
initial: routes.notes_widgets_specific_widgets_button_overview.toUri(),
navigatorKey: GlobalKey<NavigatorState>(debugLabel: "mainNavigator"),
);

class App extends StatelessWidget {
final NoteSystem noteSystem;
final SharedPreferences sharedPreferences;

// ignore: prefer_const_constructors_in_immutables
App({super.key, required this.noteSystem, required this.sharedPreferences});

@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: "flutter note",
theme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: Colors.tealAccent.shade700, brightness: Brightness.light), useMaterial3: true),
darkTheme: ThemeData(colorScheme: ColorScheme.fromSeed(seedColor: ColorSeed.m3baseline.color, brightness: Brightness.dark), useMaterial3: true),
routerConfig: router.toRouterConfig(),
);
}
}
43 changes: 7 additions & 36 deletions notes/flutter_web/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,41 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_web/pages.g.dart';
import 'package:you_flutter/better_ui.dart';
import 'package:you_note_dart/note.dart';
import 'package:flutter_web/note_app.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_web/app.dart';
import 'package:you_note_dart/note.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
NoteSystem noteSystem = await NoteSystem.load(
root: BaseNotes.rootroot,
);
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
runApp(_AppRootWidget(title: "ssss",));
}

class _AppRootWidget extends StatefulWidget {

const _AppRootWidget({required this.title});

final String title;

@override
State<_AppRootWidget> createState() => _AppRootWidgetState();

}

class _AppRootWidgetState extends State<_AppRootWidget> {
@override
Widget build(BuildContext context) {
return MaterialApp.router(
title: widget.title,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.tealAccent.shade700, brightness: Brightness.light),
useMaterial3: true),
darkTheme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: ColorSeed.m3baseline.color, brightness: Brightness.dark),
useMaterial3: true),
routerConfig: router.toRouterConfig(),
);
}
runApp(App(
sharedPreferences: await SharedPreferences.getInstance(),
noteSystem: NoteSystem(root: router.root),
));
}
137 changes: 0 additions & 137 deletions notes/flutter_web/lib/note_app.dart

This file was deleted.

Loading

0 comments on commit 16ad32e

Please sign in to comment.