Restructure to make more sense
This commit is contained in:
parent
6172338a00
commit
72d6c2ce34
3 changed files with 34 additions and 6 deletions
|
@ -7,20 +7,21 @@ import 'package:nbteditor/pages/SNBTEditor.dart';
|
|||
import 'package:nbteditor/pages/permsrequired.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
void main() {
|
||||
runApp(const MainApp());
|
||||
void main() async {
|
||||
runApp(MainApp());
|
||||
}
|
||||
|
||||
class MainApp extends StatelessWidget {
|
||||
const MainApp({super.key});
|
||||
MainApp({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
theme: ThemeData.dark(),
|
||||
routes: {
|
||||
"/": (context) => const StartPage(),
|
||||
"/edit": (context) => const Editor(),
|
||||
"/": (context) => const Editor(),
|
||||
"/add": (context) => const AddPage(),
|
||||
"/snbt": (context) => const SnbtEdit(),
|
||||
"/perms": (context) => const PermissionsRequiredPage()
|
||||
|
@ -29,6 +30,20 @@ class MainApp extends StatelessWidget {
|
|||
}
|
||||
}
|
||||
|
||||
bool needsPermissions() {
|
||||
return Platform.isIOS || Platform.isMacOS || Platform.isAndroid;
|
||||
}
|
||||
|
||||
Future<bool> needsPermissionsPage() async {
|
||||
if (needsPermissions()) {
|
||||
if (await Permission.manageExternalStorage.isDenied) {
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
class StartPage extends StatefulWidget {
|
||||
const StartPage({super.key});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue