Closed
Description
Steps to reproduce
- Run the code below.
- Open the console to see the window size info.
- Resize the window and see if the content becomes blank.
Expected results
Text is shown whatever size the window is.
Actual results
The body becomes blank when the window size is:
- height < 480, width >= 600
- height >= 900, height > width
- etc.
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 mediumAndUp
would work for medium size and any larger size. Is it wrong?
Code sample
Code sample
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),
),
],
);
},
),
},
),
),
),
);
}
}
Screenshots or Video
No response
Logs
No response
Flutter Doctor output
Doctor output
[√] Flutter (Channel stable, 3.22.3, on Microsoft Windows [Version 10.0.22631.4037], locale ja-JP)
• Flutter version 3.22.3 on channel stable at D:\xxxx\flutter\sdk
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision b0850beeb2 (4 weeks ago), 2024-07-16 21:43:41 -0700
• Engine revision 235db911ba
• Dart version 3.4.4
• DevTools version 2.34.3
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at D:\xxxx\android\sdk
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = D:\xxxx\android\sdk
• Java binary at: C:\Program Files\JetBrains\IntelliJ IDEA 2023.2.5\jbr\bin\java
• Java version OpenJDK Runtime Environment JBR-17.0.11+1-1207.30-jcef (build 17.0.11+1-b1207.30)
• All Android licenses accepted.
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.6)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.10.35201.131
• Windows 10 SDK version 10.0.22621.0
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] IntelliJ IDEA Ultimate Edition (version 2024.1)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA 2023.2.5
• Flutter plugin version 81.0.2
• Dart plugin version 241.18968.26
[√] VS Code (version 1.91.1)
• VS Code at C:\Users\xxxx\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.94.0
[√] Connected device (2 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22631.4037]
• Edge (web) • edge • web-javascript • Microsoft Edge 127.0.2651.98
[√] Network resources
• All expected network resources are available.
! Doctor found issues in 2 categories.