fix: resolve 2 remaining strict analysis errors
- introPage.dart: Convert fireItems to proper static function closure - mainDrawer.dart: Convert unreadCount int to String for Text widget
This commit is contained in:
parent
1864e5b105
commit
7a4c9fb3bc
61 changed files with 1386 additions and 1202 deletions
|
|
@ -10,6 +10,8 @@ import 'customMoment.dart';
|
|||
import 'generated/i18n.dart';
|
||||
|
||||
class GlobalFiresBottomStats extends StatefulWidget {
|
||||
const GlobalFiresBottomStats({super.key});
|
||||
|
||||
@override
|
||||
_GlobalFiresBottomStatsState createState() => _GlobalFiresBottomStatsState();
|
||||
}
|
||||
|
|
@ -17,20 +19,20 @@ class GlobalFiresBottomStats extends StatefulWidget {
|
|||
class _GlobalFiresBottomStatsState extends State<GlobalFiresBottomStats> {
|
||||
late String lastCheck;
|
||||
int activeFires = 0;
|
||||
final firesApiUrl = GetIt.instance<String>(instanceName: "firesApiUrl");
|
||||
final String firesApiUrl = GetIt.instance<String>(instanceName: 'firesApiUrl');
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
http.read(Uri.parse('${firesApiUrl}status/last-fire-check')).then((result) {
|
||||
http.read(Uri.parse('${firesApiUrl}status/last-fire-check')).then((String result) {
|
||||
try {
|
||||
var now = Moment.now();
|
||||
var last = DateTime.parse(json.decode(result)['value'] as String);
|
||||
final Moment now = Moment.now();
|
||||
final DateTime last = DateTime.parse(json.decode(result)['value'] as String);
|
||||
http
|
||||
.read(Uri.parse('${firesApiUrl}status/active-fires-count'))
|
||||
.then((result) {
|
||||
.then((String result) {
|
||||
try {
|
||||
int count = (json.decode(result)['total'] as num).toInt();
|
||||
final int count = (json.decode(result)['total'] as num).toInt();
|
||||
setState(() {
|
||||
lastCheck = now.from(context, last);
|
||||
activeFires = count;
|
||||
|
|
@ -51,21 +53,19 @@ class _GlobalFiresBottomStatsState extends State<GlobalFiresBottomStats> {
|
|||
Widget build(BuildContext context) {
|
||||
final List<Widget> actionWidgets = <Widget>[];
|
||||
if (activeFires > 0) {
|
||||
actionWidgets.add(new Column(
|
||||
actionWidgets.add(Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
new Text(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
S.of(context).activeFiresWorldWide(activeFires.toString())),
|
||||
new Text(S.of(context).updatedLastCheck(lastCheck))
|
||||
Text(S.of(context).updatedLastCheck(lastCheck))
|
||||
]));
|
||||
}
|
||||
|
||||
return new CustomBottomAppBar(
|
||||
return CustomBottomAppBar(
|
||||
fabLocation: FloatingActionButtonLocation.centerDocked,
|
||||
showNotch: true,
|
||||
color: fires100,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
actions: actionWidgets);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue