Skip to content

Commit 558b6e3

Browse files
authored
[flutter_adaptive_scaffold] : 🐛 [FIX] : Issue: 121392. (flutter#3297)
[flutter_adaptive_scaffold] : � [FIX] : Issue: 121392.
1 parent bbf86a7 commit 558b6e3

File tree

9 files changed

+412
-113
lines changed

9 files changed

+412
-113
lines changed

packages/flutter_adaptive_scaffold/CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.1.2
2+
3+
* Fixes `NavigationRail` items not considering `NavigationRailTheme` values - [flutter/flutter#121135](https://github.com/flutter/flutter/issues/121135)
4+
* When `NavigationRailTheme` is provided, it will use the theme for values that the user has not given explicit theme-related values for.
5+
16
## 0.1.1
27

38
* Fixes flutter/flutter#121135) `selectedIcon` parameter not displayed even if it is provided.
@@ -11,7 +16,6 @@
1116
* Change the `selectedIndex` parameter on `standardNavigationRail` to allow null values to indicate "no destination".
1217
* An explicitly null `currentIndex` parameter passed to `standardBottomNavigationBar` will also default to 0, just like implicitly null missing parameters.
1318

14-
1519
## 0.0.9
1620

1721
* Fix passthrough of `leadingExtendedNavRail`, `leadingUnextendedNavRail` and `trailingNavRail`

packages/flutter_adaptive_scaffold/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ displayed and the entrance animation and exit animation.
159159
destinations: destinations
160160
.map((_) => AdaptiveScaffold.toRailDestination(_))
161161
.toList(),
162+
backgroundColor: navRailTheme.backgroundColor,
163+
selectedIconTheme: navRailTheme.selectedIconTheme,
164+
unselectedIconTheme: navRailTheme.unselectedIconTheme,
165+
selectedLabelTextStyle: navRailTheme.selectedLabelTextStyle,
166+
unSelectedLabelTextStyle: navRailTheme.unselectedLabelTextStyle,
162167
),
163168
),
164169
Breakpoints.large: SlotLayout.from(
@@ -186,6 +191,11 @@ displayed and the entrance animation and exit animation.
186191
.map((_) => AdaptiveScaffold.toRailDestination(_))
187192
.toList(),
188193
trailing: trailingNavRail,
194+
backgroundColor: navRailTheme.backgroundColor,
195+
selectedIconTheme: navRailTheme.selectedIconTheme,
196+
unselectedIconTheme: navRailTheme.unselectedIconTheme,
197+
selectedLabelTextStyle: navRailTheme.selectedLabelTextStyle,
198+
unSelectedLabelTextStyle: navRailTheme.unselectedLabelTextStyle,
189199
),
190200
),
191201
},

packages/flutter_adaptive_scaffold/example/lib/adaptive_layout_demo.dart

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ class _MyHomePageState extends State<MyHomePage> {
4040

4141
@override
4242
Widget build(BuildContext context) {
43+
final NavigationRailThemeData navRailTheme =
44+
Theme.of(context).navigationRailTheme;
45+
4346
// Define the children to display within the body.
4447
final List<Widget> children = List<Widget>.generate(10, (int index) {
4548
return Padding(
@@ -57,9 +60,7 @@ class _MyHomePageState extends State<MyHomePage> {
5760
const SizedBox(height: 10),
5861
Row(
5962
children: const <Widget>[
60-
SizedBox(
61-
width: 27,
62-
),
63+
SizedBox(width: 27),
6364
Text('Folders', style: TextStyle(fontSize: 16)),
6465
],
6566
),
@@ -68,49 +69,65 @@ class _MyHomePageState extends State<MyHomePage> {
6869
children: <Widget>[
6970
const SizedBox(width: 16),
7071
IconButton(
71-
onPressed: () {},
72-
icon: const Icon(Icons.folder_copy_outlined),
73-
iconSize: 21),
72+
onPressed: () {},
73+
icon: const Icon(Icons.folder_copy_outlined),
74+
iconSize: 21,
75+
),
7476
const SizedBox(width: 21),
75-
const Text('Freelance'),
77+
Flexible(
78+
child: const Text(
79+
'Freelance',
80+
overflow: TextOverflow.ellipsis,
81+
),
82+
),
7683
],
7784
),
7885
const SizedBox(height: 12),
7986
Row(
8087
children: <Widget>[
8188
const SizedBox(width: 16),
8289
IconButton(
83-
onPressed: () {},
84-
icon: const Icon(Icons.folder_copy_outlined),
85-
iconSize: 21),
90+
onPressed: () {},
91+
icon: const Icon(Icons.folder_copy_outlined),
92+
iconSize: 21,
93+
),
8694
const SizedBox(width: 21),
87-
const Text('Mortgage'),
95+
Flexible(
96+
child: const Text(
97+
'Mortgage',
98+
overflow: TextOverflow.ellipsis,
99+
),
100+
),
88101
],
89102
),
90103
const SizedBox(height: 12),
91104
Row(
92105
children: <Widget>[
93106
const SizedBox(width: 16),
94107
IconButton(
95-
onPressed: () {},
96-
icon: const Icon(Icons.folder_copy_outlined),
97-
iconSize: 21),
108+
onPressed: () {},
109+
icon: const Icon(Icons.folder_copy_outlined),
110+
iconSize: 21,
111+
),
98112
const SizedBox(width: 21),
99113
const Flexible(
100-
child: Text('Taxes', overflow: TextOverflow.ellipsis)),
114+
child: Text('Taxes', overflow: TextOverflow.ellipsis),
115+
),
101116
],
102117
),
103118
const SizedBox(height: 12),
104119
Row(
105120
children: <Widget>[
106121
const SizedBox(width: 16),
107122
IconButton(
108-
onPressed: () {},
109-
icon: const Icon(Icons.folder_copy_outlined),
110-
iconSize: 21),
123+
onPressed: () {},
124+
icon: const Icon(Icons.folder_copy_outlined),
125+
iconSize: 21,
126+
),
111127
const SizedBox(width: 21),
112128
const Flexible(
113-
child: Text('Receipts', overflow: TextOverflow.ellipsis)),
129+
child: Text('Receipts', overflow: TextOverflow.ellipsis),
130+
),
114131
],
115132
),
116133
],
@@ -163,6 +180,11 @@ class _MyHomePageState extends State<MyHomePage> {
163180
destinations: destinations
164181
.map((_) => AdaptiveScaffold.toRailDestination(_))
165182
.toList(),
183+
backgroundColor: navRailTheme.backgroundColor,
184+
selectedIconTheme: navRailTheme.selectedIconTheme,
185+
unselectedIconTheme: navRailTheme.unselectedIconTheme,
186+
selectedLabelTextStyle: navRailTheme.selectedLabelTextStyle,
187+
unSelectedLabelTextStyle: navRailTheme.unselectedLabelTextStyle,
166188
),
167189
),
168190
Breakpoints.large: SlotLayout.from(
@@ -190,6 +212,11 @@ class _MyHomePageState extends State<MyHomePage> {
190212
.map((_) => AdaptiveScaffold.toRailDestination(_))
191213
.toList(),
192214
trailing: trailingNavRail,
215+
backgroundColor: navRailTheme.backgroundColor,
216+
selectedIconTheme: navRailTheme.selectedIconTheme,
217+
unselectedIconTheme: navRailTheme.unselectedIconTheme,
218+
selectedLabelTextStyle: navRailTheme.selectedLabelTextStyle,
219+
unSelectedLabelTextStyle: navRailTheme.unselectedLabelTextStyle,
193220
),
194221
),
195222
},

packages/flutter_adaptive_scaffold/example/lib/adaptive_scaffold_demo.dart

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,28 @@ class MyApp extends StatelessWidget {
1616

1717
@override
1818
Widget build(BuildContext context) {
19-
return const MaterialApp(home: MyHomePage());
19+
return MaterialApp(
20+
theme: ThemeData.light().copyWith(
21+
navigationRailTheme: const NavigationRailThemeData(
22+
selectedIconTheme: IconThemeData(
23+
color: Colors.red,
24+
size: 28,
25+
),
26+
selectedLabelTextStyle: TextStyle(
27+
fontSize: 16,
28+
color: Colors.red,
29+
),
30+
unselectedLabelTextStyle: TextStyle(
31+
fontSize: 14,
32+
color: Colors.black,
33+
),
34+
),
35+
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
36+
type: BottomNavigationBarType.fixed,
37+
),
38+
),
39+
home: const MyHomePage(),
40+
);
2041
}
2142
}
2243

0 commit comments

Comments
 (0)