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,
|
||||
|
||||
Reference in New Issue
Block a user