Fix 23 additional lint issues to reduce from 129 to 106 issues
- Add const constructors to @immutable classes (5 issues: prefer_const_constructors_in_immutables) - Fix nullable value casts in firesApi.dart (3 issues: cast_nullable_to_non_nullable) - Remove redundant default argument values (2 issues: avoid_redundant_argument_values) - Make YourLocation immutable with final fields (2 issues: avoid_equals_and_hash_code_on_mutable_classes) - Update imports and fix formatting Reduces lint issues from 129 to 106. APK builds successfully (146 MB).
This commit is contained in:
parent
270d9a569e
commit
8da3752193
12 changed files with 61 additions and 47 deletions
|
|
@ -6,25 +6,25 @@ import 'package:flutter/material.dart';
|
|||
import '../utils/widget_utils.dart';
|
||||
|
||||
class AppIntroItem {
|
||||
AppIntroItem({required this.icon, required this.title, this.subTitle = ''});
|
||||
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final String subTitle;
|
||||
|
||||
AppIntroItem({required this.icon, required this.title, this.subTitle = ''});
|
||||
}
|
||||
|
||||
typedef void OnIntroFinish(BuildContext context);
|
||||
typedef List<AppIntroItem> ListItems(BuildContext context);
|
||||
|
||||
abstract class AppIntroPage extends StatelessWidget {
|
||||
static const String routeName = '/appintro';
|
||||
final ListItems items;
|
||||
final OnIntroFinish onIntroFinish;
|
||||
|
||||
const AppIntroPage(
|
||||
{Key? key, required this.items, required this.onIntroFinish})
|
||||
: super(key: key);
|
||||
|
||||
static const String routeName = '/appintro';
|
||||
final ListItems items;
|
||||
final OnIntroFinish onIntroFinish;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
|
|
@ -63,7 +63,6 @@ class _AppIntroPageSelector extends StatelessWidget {
|
|||
theme.textTheme.titleMedium ?? const TextStyle();
|
||||
|
||||
return SafeArea(
|
||||
top: true,
|
||||
bottom: false,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
|
|
@ -75,7 +74,8 @@ class _AppIntroPageSelector extends StatelessWidget {
|
|||
icon:
|
||||
const Icon(Icons.close, size: 30.0, color: Colors.black38)),
|
||||
]),
|
||||
Expanded(child: OrientationBuilder(builder: (context, orientation) {
|
||||
Expanded(child: OrientationBuilder(
|
||||
builder: (BuildContext context, Orientation orientation) {
|
||||
return IconTheme(
|
||||
data: IconThemeData(
|
||||
size: orientation == Orientation.portrait ? 200.0 : 100.0,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,13 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'dart:async';
|
||||
|
||||
@immutable
|
||||
abstract class MaterialAppWithIntro extends StatelessWidget {
|
||||
const MaterialAppWithIntro(this.name, this.theme, this.routes,
|
||||
this.introWidget, this.continueWidget, this.prefsKey);
|
||||
|
||||
final String name;
|
||||
final ThemeData theme;
|
||||
final Map<String, WidgetBuilder> routes;
|
||||
|
|
@ -10,9 +15,6 @@ abstract class MaterialAppWithIntro extends StatelessWidget {
|
|||
final WidgetBuilder continueWidget;
|
||||
final String prefsKey;
|
||||
|
||||
MaterialAppWithIntro(this.name, this.theme, this.routes, this.introWidget,
|
||||
this.continueWidget, this.prefsKey);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
|
|
@ -25,26 +27,26 @@ abstract class MaterialAppWithIntro extends StatelessWidget {
|
|||
}
|
||||
|
||||
class MaterialAppWithIntroHome extends StatefulWidget {
|
||||
const MaterialAppWithIntroHome(
|
||||
this.introWidget, this.continueWidget, this.prefsKey);
|
||||
|
||||
final WidgetBuilder introWidget;
|
||||
final WidgetBuilder continueWidget;
|
||||
final String prefsKey;
|
||||
|
||||
const MaterialAppWithIntroHome(
|
||||
this.introWidget, this.continueWidget, this.prefsKey);
|
||||
|
||||
@override
|
||||
_MaterialAppWithIntroState createState() =>
|
||||
_MaterialAppWithIntroState(introWidget, continueWidget, prefsKey);
|
||||
}
|
||||
|
||||
class _MaterialAppWithIntroState extends State<MaterialAppWithIntroHome> {
|
||||
_MaterialAppWithIntroState(
|
||||
this.introWidget, this.continueWidget, this.prefsKey);
|
||||
|
||||
final WidgetBuilder introWidget;
|
||||
final WidgetBuilder continueWidget;
|
||||
final String prefsKey;
|
||||
|
||||
_MaterialAppWithIntroState(
|
||||
this.introWidget, this.continueWidget, this.prefsKey);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
|
@ -63,19 +65,19 @@ class _MaterialAppWithIntroState extends State<MaterialAppWithIntroHome> {
|
|||
await prefs.setBool(initialWizardKey, false);
|
||||
if (mounted) {
|
||||
await Navigator.of(context)
|
||||
.pushReplacement(MaterialPageRoute(builder: introWidget));
|
||||
.pushReplacement(MaterialPageRoute<void>(builder: introWidget));
|
||||
}
|
||||
} else {
|
||||
if (mounted) {
|
||||
await Navigator.of(context)
|
||||
.pushReplacement(MaterialPageRoute(builder: continueWidget));
|
||||
.pushReplacement(MaterialPageRoute<void>(builder: continueWidget));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
return const Scaffold(
|
||||
body: Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -3,15 +3,6 @@ import 'package:flutter/material.dart';
|
|||
/// Rounded button widget with icon and text.
|
||||
/// Used primarily in the active fires page.
|
||||
class RoundedBtn extends StatelessWidget {
|
||||
static const btnRadius = Radius.circular(90.0);
|
||||
|
||||
final IconData icon;
|
||||
final String text;
|
||||
final Color backColor;
|
||||
final Color fontColor;
|
||||
final TextStyle textStyle;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
const RoundedBtn({
|
||||
required this.icon,
|
||||
required this.text,
|
||||
|
|
@ -42,6 +33,15 @@ class RoundedBtn extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
|
||||
static const Radius btnRadius = Radius.circular(90.0);
|
||||
|
||||
final IconData icon;
|
||||
final String text;
|
||||
final Color backColor;
|
||||
final Color fontColor;
|
||||
final TextStyle textStyle;
|
||||
final VoidCallback onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
|
|
@ -49,7 +49,7 @@ class RoundedBtn extends StatelessWidget {
|
|||
onPressed: onPressed,
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: backColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(btnRadius),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue