mirror of
https://github.com/zontreck/NBTEditor
synced 2024-11-21 13:48:56 -07:00
Apply autofixes
This commit is contained in:
parent
9055c8cb0a
commit
d117972d0c
3 changed files with 14 additions and 12 deletions
|
@ -1,4 +1,3 @@
|
|||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -13,7 +12,6 @@ import 'package:nbteditor/Consts2.dart';
|
|||
import 'package:nbteditor/SessionData.dart';
|
||||
import 'package:nbteditor/tags/CompoundTag.dart';
|
||||
import 'package:nbteditor/tags/Tag.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
class Editor extends StatefulWidget {
|
||||
const Editor({super.key});
|
||||
|
|
|
@ -17,17 +17,19 @@ class MainApp extends StatelessWidget {
|
|||
return MaterialApp(
|
||||
theme: ThemeData.dark(),
|
||||
routes: {
|
||||
"/": (context) => StartPage(),
|
||||
"/": (context) => const StartPage(),
|
||||
"/edit": (context) => const Editor(),
|
||||
"/add": (context) => const AddPage(),
|
||||
"/snbt": (context) => const SnbtEdit(),
|
||||
"/perms": (context) => PermissionsRequiredPage()
|
||||
"/perms": (context) => const PermissionsRequiredPage()
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class StartPage extends StatefulWidget {
|
||||
const StartPage({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return StartPageState();
|
||||
|
@ -42,7 +44,7 @@ class StartPageState extends State<StartPage> {
|
|||
|
||||
Future<void> checkPermissions() async {
|
||||
if (await Permission.manageExternalStorage.isDenied) {
|
||||
await Future.delayed(Duration(seconds: 5), () {
|
||||
await Future.delayed(const Duration(seconds: 5), () {
|
||||
Navigator.pushReplacementNamed(context, "/perms");
|
||||
});
|
||||
} else {
|
||||
|
@ -52,7 +54,7 @@ class StartPageState extends State<StartPage> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return const Scaffold(
|
||||
body: Column(
|
||||
children: [Image(image: AssetImage("Icons/PNG/nbteditor.png"))],
|
||||
),
|
||||
|
|
|
@ -3,19 +3,21 @@ import 'package:nbteditor/Constants.dart';
|
|||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
class PermissionsRequiredPage extends StatelessWidget {
|
||||
const PermissionsRequiredPage({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("NBT Editor - Permissions Denied"),
|
||||
title: const Text("NBT Editor - Permissions Denied"),
|
||||
backgroundColor: Constants.TITLEBAR_COLOR,
|
||||
),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
ListTile(
|
||||
const ListTile(
|
||||
title: Text(
|
||||
"We require only one permission, it is being denied by your device. Please grant file permissions to be able to open or save files."),
|
||||
),
|
||||
|
@ -25,17 +27,17 @@ class PermissionsRequiredPage extends StatelessWidget {
|
|||
var stat =
|
||||
await Permission.manageExternalStorage.request();
|
||||
if (stat.isPermanentlyDenied) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||
content: Text(
|
||||
"The storage permission is reporting it is permanently denied. Please open settings and allow that permission.")));
|
||||
} else if (stat.isGranted) {
|
||||
Future.delayed(Duration(seconds: 5), () {
|
||||
Future.delayed(const Duration(seconds: 5), () {
|
||||
Navigator.pushReplacementNamed(context, "/edit");
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
child: Text("GRANT"))
|
||||
child: const Text("GRANT"))
|
||||
],
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue