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 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -13,7 +12,6 @@ import 'package:nbteditor/Consts2.dart';
|
||||||
import 'package:nbteditor/SessionData.dart';
|
import 'package:nbteditor/SessionData.dart';
|
||||||
import 'package:nbteditor/tags/CompoundTag.dart';
|
import 'package:nbteditor/tags/CompoundTag.dart';
|
||||||
import 'package:nbteditor/tags/Tag.dart';
|
import 'package:nbteditor/tags/Tag.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
|
||||||
|
|
||||||
class Editor extends StatefulWidget {
|
class Editor extends StatefulWidget {
|
||||||
const Editor({super.key});
|
const Editor({super.key});
|
||||||
|
|
|
@ -17,17 +17,19 @@ class MainApp extends StatelessWidget {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
theme: ThemeData.dark(),
|
theme: ThemeData.dark(),
|
||||||
routes: {
|
routes: {
|
||||||
"/": (context) => StartPage(),
|
"/": (context) => const StartPage(),
|
||||||
"/edit": (context) => const Editor(),
|
"/edit": (context) => const Editor(),
|
||||||
"/add": (context) => const AddPage(),
|
"/add": (context) => const AddPage(),
|
||||||
"/snbt": (context) => const SnbtEdit(),
|
"/snbt": (context) => const SnbtEdit(),
|
||||||
"/perms": (context) => PermissionsRequiredPage()
|
"/perms": (context) => const PermissionsRequiredPage()
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class StartPage extends StatefulWidget {
|
class StartPage extends StatefulWidget {
|
||||||
|
const StartPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() {
|
State<StatefulWidget> createState() {
|
||||||
return StartPageState();
|
return StartPageState();
|
||||||
|
@ -42,7 +44,7 @@ class StartPageState extends State<StartPage> {
|
||||||
|
|
||||||
Future<void> checkPermissions() async {
|
Future<void> checkPermissions() async {
|
||||||
if (await Permission.manageExternalStorage.isDenied) {
|
if (await Permission.manageExternalStorage.isDenied) {
|
||||||
await Future.delayed(Duration(seconds: 5), () {
|
await Future.delayed(const Duration(seconds: 5), () {
|
||||||
Navigator.pushReplacementNamed(context, "/perms");
|
Navigator.pushReplacementNamed(context, "/perms");
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -52,7 +54,7 @@ class StartPageState extends State<StartPage> {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return const Scaffold(
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [Image(image: AssetImage("Icons/PNG/nbteditor.png"))],
|
children: [Image(image: AssetImage("Icons/PNG/nbteditor.png"))],
|
||||||
),
|
),
|
||||||
|
|
|
@ -3,19 +3,21 @@ import 'package:nbteditor/Constants.dart';
|
||||||
import 'package:permission_handler/permission_handler.dart';
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
class PermissionsRequiredPage extends StatelessWidget {
|
class PermissionsRequiredPage extends StatelessWidget {
|
||||||
|
const PermissionsRequiredPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text("NBT Editor - Permissions Denied"),
|
title: const Text("NBT Editor - Permissions Denied"),
|
||||||
backgroundColor: Constants.TITLEBAR_COLOR,
|
backgroundColor: Constants.TITLEBAR_COLOR,
|
||||||
),
|
),
|
||||||
body: Padding(
|
body: Padding(
|
||||||
padding: EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
const ListTile(
|
||||||
title: Text(
|
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."),
|
"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 =
|
var stat =
|
||||||
await Permission.manageExternalStorage.request();
|
await Permission.manageExternalStorage.request();
|
||||||
if (stat.isPermanentlyDenied) {
|
if (stat.isPermanentlyDenied) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(const SnackBar(
|
||||||
content: Text(
|
content: Text(
|
||||||
"The storage permission is reporting it is permanently denied. Please open settings and allow that permission.")));
|
"The storage permission is reporting it is permanently denied. Please open settings and allow that permission.")));
|
||||||
} else if (stat.isGranted) {
|
} else if (stat.isGranted) {
|
||||||
Future.delayed(Duration(seconds: 5), () {
|
Future.delayed(const Duration(seconds: 5), () {
|
||||||
Navigator.pushReplacementNamed(context, "/edit");
|
Navigator.pushReplacementNamed(context, "/edit");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: Text("GRANT"))
|
child: const Text("GRANT"))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue