mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
Some linting_tool updates and cleanup (#1279)
This commit is contained in:
@@ -46,7 +46,7 @@ class _AdaptiveNavState extends State<AdaptiveNav> {
|
||||
),
|
||||
];
|
||||
|
||||
final trailing = <String, IconData>{
|
||||
const trailing = <String, IconData>{
|
||||
'About': Icons.info_outline,
|
||||
};
|
||||
|
||||
@@ -62,25 +62,25 @@ class _NavView extends StatefulWidget {
|
||||
const _NavView({
|
||||
required this.extended,
|
||||
required this.destinations,
|
||||
this.trailing,
|
||||
this.trailing = const {},
|
||||
});
|
||||
|
||||
final bool extended;
|
||||
final List<_Destination> destinations;
|
||||
final Map<String, IconData>? trailing;
|
||||
final Map<String, IconData> trailing;
|
||||
|
||||
@override
|
||||
_NavViewState createState() => _NavViewState();
|
||||
}
|
||||
|
||||
class _NavViewState extends State<_NavView> {
|
||||
late ValueNotifier<bool?> _isExtended;
|
||||
late final ValueNotifier<bool> _isExtended;
|
||||
var _selectedIndex = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_isExtended = ValueNotifier<bool?>(widget.extended);
|
||||
_isExtended = ValueNotifier<bool>(widget.extended);
|
||||
}
|
||||
|
||||
void _onDestinationSelected(int index) {
|
||||
@@ -91,7 +91,7 @@ class _NavViewState extends State<_NavView> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var textTheme = Theme.of(context).textTheme;
|
||||
final textTheme = Theme.of(context).textTheme;
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(
|
||||
@@ -115,7 +115,7 @@ class _NavViewState extends State<_NavView> {
|
||||
minHeight: constraints.maxHeight,
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: ValueListenableBuilder<bool?>(
|
||||
child: ValueListenableBuilder<bool>(
|
||||
valueListenable: _isExtended,
|
||||
builder: (context, value, child) {
|
||||
var isSmallDisplay = isDisplaySmall(context);
|
||||
@@ -130,13 +130,13 @@ class _NavViewState extends State<_NavView> {
|
||||
label: Text(destination.textLabel),
|
||||
),
|
||||
],
|
||||
extended: _isExtended.value! && !isSmallDisplay,
|
||||
extended: _isExtended.value && !isSmallDisplay,
|
||||
labelType: NavigationRailLabelType.none,
|
||||
leading: _NavigationRailHeader(
|
||||
extended: _isExtended,
|
||||
),
|
||||
trailing: _NavigationRailTrailingSection(
|
||||
trailingDestinations: widget.trailing!,
|
||||
trailingDestinations: widget.trailing,
|
||||
),
|
||||
selectedIndex: _selectedIndex,
|
||||
onDestinationSelected: _onDestinationSelected,
|
||||
|
||||
@@ -13,6 +13,7 @@ import 'package:provider/provider.dart';
|
||||
|
||||
class LintExpansionTile extends StatefulWidget {
|
||||
final Rule rule;
|
||||
|
||||
const LintExpansionTile({
|
||||
required this.rule,
|
||||
super.key,
|
||||
@@ -24,10 +25,11 @@ class LintExpansionTile extends StatefulWidget {
|
||||
|
||||
class _LintExpansionTileState extends State<LintExpansionTile> {
|
||||
var isExpanded = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var theme = Theme.of(context);
|
||||
var textTheme = theme.textTheme;
|
||||
final theme = Theme.of(context);
|
||||
final textTheme = theme.textTheme;
|
||||
final rule = widget.rule;
|
||||
final incompatibleString =
|
||||
rule.incompatible.isNotEmpty ? rule.incompatible.join(', ') : 'none';
|
||||
@@ -287,8 +289,8 @@ class ExistingProfileDialog extends StatefulWidget {
|
||||
class _ExistingProfileDialogState extends State<ExistingProfileDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var profilesStore = Provider.of<ProfilesStore>(context);
|
||||
var savedProfiles = profilesStore.savedProfiles;
|
||||
final profilesStore = Provider.of<ProfilesStore>(context);
|
||||
final savedProfiles = profilesStore.savedProfiles;
|
||||
return AlertDialog(
|
||||
title: const Text('Select a lint profile'),
|
||||
content: Column(
|
||||
|
||||
@@ -12,6 +12,7 @@ import 'package:provider/provider.dart';
|
||||
|
||||
class SavedRuleTile extends StatefulWidget {
|
||||
final Rule rule;
|
||||
|
||||
const SavedRuleTile({
|
||||
required this.rule,
|
||||
super.key,
|
||||
@@ -27,8 +28,8 @@ class _SavedRuleTileState extends State<SavedRuleTile> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var theme = Theme.of(context);
|
||||
var textTheme = theme.textTheme;
|
||||
final theme = Theme.of(context);
|
||||
final textTheme = theme.textTheme;
|
||||
final rule = widget.rule;
|
||||
final incompatibleString =
|
||||
rule.incompatible.isNotEmpty ? rule.incompatible.join(', ') : 'none';
|
||||
|
||||
Reference in New Issue
Block a user