Apply automatic dart fixes

This commit is contained in:
zontreck 2023-11-04 01:38:04 -07:00
parent fc9dc6f4d3
commit e0561ea13f
6 changed files with 41 additions and 49 deletions

View file

@ -1,7 +1,6 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:hive_flutter/adapters.dart';
import 'package:servermanager/mod.dart';
import 'package:servermanager/settings.dart';
@ -34,8 +33,9 @@ class GameServerPageState extends State<GameServerPage> {
SnackBar(content: Text("Wait until the download completes")));
return false;
} else
} else {
return true;
}
},
child: SingleChildScrollView(
padding: EdgeInsets.all(16),
@ -199,11 +199,11 @@ class ModManagerState extends State<ModManager> {
itemBuilder: (ctx, idx) {
Mod mod = settings.inst!.mods[idx];
return Padding(
key: Key("${mod.mod_instance_id()}"),
key: Key(mod.mod_instance_id()),
padding: EdgeInsets.all(12),
child: ListTile(
title: Text(mod.mod_name),
subtitle: Text("ID: " + mod.mod_id.toString()),
subtitle: Text("ID: ${mod.mod_id}"),
onTap: () async {
final reply = await Navigator.pushNamed(
context, "/server/mods/edit",
@ -212,14 +212,15 @@ class ModManagerState extends State<ModManager> {
mod_name: mod.mod_name,
newMod: false));
if (reply != null)
if (reply != null) {
setState(() {
settings.inst!.mods[idx] = reply as Mod;
});
else
} else {
setState(() {
settings.inst!.mods.removeAt(idx);
});
}
},
),
);
@ -352,16 +353,17 @@ class ModPage extends StatelessWidget {
]),
),
onWillPop: () async {
int id_val = 0;
int idVal = 0;
try {
id_val = int.parse(id.text);
idVal = int.parse(id.text);
} catch (E) {}
if (willDelete)
if (willDelete) {
Navigator.pop(context, null);
else
} else {
Navigator.pop(context,
Mod(mod_id: id_val, mod_name: name.text, newMod: false));
Mod(mod_id: idVal, mod_name: name.text, newMod: false));
}
return true;
},
),