import 'package:flutter/material.dart';
import 'package:flutter_adaptive_scaffold/flutter_adaptive_scaffold.dart';
const destinations = [
(icon: Icon(Icons.star), label: 'Star'),
(icon: Icon(Icons.favorite), label: 'Heart'),
];
void main() => runApp(const App());
class App extends StatefulWidget {
const App();
@override
State<App> createState() => _AppState();
}
class _AppState extends State<App> {
int _index = 0;
@override
Widget build(BuildContext context) {
print(MediaQuery.sizeOf(context));
return MaterialApp(
home: Scaffold(
body: AdaptiveLayout(
transitionDuration: Duration.zero,
body: SlotLayout(
config: {
Breakpoints.small: SlotLayout.from(
key: const ValueKey('small body'),
builder: (context) {
return Center(
child: Text('Small: ${destinations[_index].label}'),
);
},
),
Breakpoints.mediumAndUp: SlotLayout.from(
key: const ValueKey('mediumAndUp body'),
builder: (context) {
return Center(
child: Text('Medium and up: ${destinations[_index].label}'),
);
},
),
},
),
bottomNavigation: SlotLayout(
config: {
Breakpoints.small: SlotLayout.from(
key: const ValueKey('bottomNavigation'),
builder: (context) {
return AdaptiveScaffold.standardBottomNavigationBar(
currentIndex: _index,
onDestinationSelected: (index) {
setState(() => _index = index);
},
destinations: [
for (final destination in destinations)
NavigationDestination(
icon: destination.icon,
label: destination.label,
),
],
);
},
),
},
),
primaryNavigation: SlotLayout(
config: {
Breakpoints.mediumAndUp: SlotLayout.from(
key: const ValueKey('primaryNavigation'),
builder: (context) {
return AdaptiveScaffold.standardNavigationRail(
selectedIndex: _index,
onDestinationSelected: (index) {
setState(() => _index = index);
},
destinations: [
for (final destination in destinations)
NavigationRailDestination(
icon: destination.icon,
label: Text(destination.label),
),
],
);
},
),
},
),
),
),
);
}
}
Steps to reproduce
Expected results
Text is shown whatever size the window is.
Actual results
The body becomes blank when the window size is:
flutter_adaptive_scaffold 0.1.12 and below don't have this issue. I'm not sure if the suddenly changed behaviour is related to some of the breaking changes in 0.2.0 mentioned in the change log.
I was expecting
mediumAndUpwould work for medium size and any larger size. Is it wrong?Code sample
Code sample
Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor output