- Add devbox.json pinning Flutter 3.35.7, Android SDK (Nix flake), openjdk17, just, openssl - Add android/nix-android-sdk/ Nix flake + flake.lock + Android Studio config script - Add justfile with build/get/upgrade/icons/analyze/rebuild recipes - flutter pub upgrade --major-versions: file_picker ^11, google_fonts ^8, permission_handler ^12, share_plus ^12, flutter_lints ^6 (+71 transitive) - Fix file_picker v11 API: FilePicker.platform → FilePicker.getDirectoryPath() - Fix all 37 analyzer issues: deprecated APIs (window, WillPopScope, Share, SvgPicture color), async BuildContext guards, key constructors, private createState() return types, unused locals, print → debugPrint, etc. - Hook _handleCommand into onSubmitted for : prefix commands - Android: Gradle 8.3→8.11.1, AGP 8.2.2→8.9.1, KGP 1.8.22→2.2.20, compileSdk/targetSdk 34→36, namespace auto-derivation for library modules, kotlin.compiler.execution.strategy=in-process Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
82 lines
2.3 KiB
Dart
Executable file
82 lines
2.3 KiB
Dart
Executable file
import 'package:flutter/foundation.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
import 'themes/day.dart';
|
|
import 'themes/night.dart';
|
|
import 'note_list.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
await Permission.storage.request();
|
|
LicenseRegistry.addLicense(() async* {
|
|
final license = await rootBundle.loadString('google_fonts/OFL.txt');
|
|
yield LicenseEntryWithLineBreaks(['google_fonts'], license);
|
|
});
|
|
runApp(const MuzzleVelocityApp());
|
|
}
|
|
|
|
class MuzzleVelocityApp extends StatefulWidget {
|
|
const MuzzleVelocityApp({super.key});
|
|
|
|
@override
|
|
State<MuzzleVelocityApp> createState() => _MuzzleVelocityAppState();
|
|
}
|
|
|
|
class _MuzzleVelocityAppState extends State<MuzzleVelocityApp> {
|
|
ThemeMode _themeMode = ThemeMode.system;
|
|
bool showTags = true;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
// Ensure the correct theme mode is set on startup
|
|
_themeMode =
|
|
WidgetsBinding.instance.platformDispatcher.platformBrightness == Brightness.dark
|
|
? ThemeMode.dark
|
|
: ThemeMode.light;
|
|
}
|
|
|
|
void _toggleTheme(bool darkMode) {
|
|
if (mounted) {
|
|
setState(() {
|
|
_themeMode = darkMode ? ThemeMode.dark : ThemeMode.light;
|
|
});
|
|
}
|
|
}
|
|
|
|
void _toggleTags() {
|
|
if (mounted) {
|
|
setState(() {
|
|
showTags = !showTags;
|
|
});
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Muzzle Velocity',
|
|
theme: ThemeData(
|
|
brightness: Brightness.light,
|
|
scaffoldBackgroundColor: Color(0xffF6F4F1),
|
|
appBarTheme: AppBarTheme(backgroundColor: Color(0xffF6F4F1)),
|
|
textTheme: GoogleFonts.ibmPlexMonoTextTheme(dayText),
|
|
),
|
|
darkTheme: ThemeData(
|
|
brightness: Brightness.dark,
|
|
scaffoldBackgroundColor: Color(0xFF121212),
|
|
appBarTheme: AppBarTheme(backgroundColor: Color(0xFF121212)),
|
|
textTheme: GoogleFonts.ibmPlexMonoTextTheme(nightText),
|
|
),
|
|
themeMode: _themeMode,
|
|
home: NoteListScreen(
|
|
toggleTheme: _toggleTheme,
|
|
toggleTags: _toggleTags,
|
|
isDarkMode: _themeMode == ThemeMode.dark,
|
|
showTags: showTags,
|
|
),
|
|
);
|
|
}
|
|
}
|