material-components-flutter-adaptive icon indicating copy to clipboard operation
material-components-flutter-adaptive copied to clipboard

Sometimes AdaptiveContainers are not shown

Open orestesgaolin opened this issue 3 years ago • 0 comments

Consider following code:

import 'package:adaptive_components/adaptive_components.dart';
import 'package:flutter/cupertino.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'App',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      darkTheme: ThemeData(
        primarySwatch: Colors.blue,
        brightness: Brightness.dark,
      ),
      themeMode: ThemeMode.system,
      home: Home(),
    );
  }
}

class Home extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Row(
        children: [
          NavigationRail(
            selectedIndex: 0,
            onDestinationSelected: (index) {},
            // extended: true,
            destinations: [
              NavigationRailDestination(
                icon: Icon(CupertinoIcons.list_dash),
                label: Text('List'),
              ),
              NavigationRailDestination(
                icon: Icon(CupertinoIcons.settings),
                label: Text('Settings'),
              ),
            ],
          ),
          VerticalDivider(thickness: 1, width: 1),
          Expanded(
            child: AdaptiveColumn(
              children: [
                AdaptiveContainer(
                  columnSpan: 4,
                  child: DecoratedBox(
                    decoration: BoxDecoration(
                      boxShadow: [
                        BoxShadow(),
                      ],
                    ),
                    child: Padding(
                      padding: const EdgeInsets.all(16.0),
                      child: Center(child: Text('No projects')),
                    ),
                  ),
                ),
                AdaptiveContainer(
                  columnSpan: 4,
                  child: DecoratedBox(
                    decoration: BoxDecoration(
                      boxShadow: [
                        BoxShadow(),
                      ],
                    ),
                    child: Padding(
                      padding: const EdgeInsets.all(16.0),
                      child: Center(child: Text('No projects')),
                    ),
                  ),
                ),
                AdaptiveContainer(
                  columnSpan: 2,
                  child: DecoratedBox(
                    decoration: BoxDecoration(
                      boxShadow: [
                        BoxShadow(),
                      ],
                    ),
                    child: Padding(
                      padding: const EdgeInsets.all(16.0),
                      child: Center(child: Text('No projects')),
                    ),
                  ),
                ),
              ],
            ),
          )
        ],
      ),
    );
  }
}

When resizing the screen on macOS the containers disappear and appear in strange way:

https://user-images.githubusercontent.com/16854239/106529392-ac410800-64ea-11eb-861e-5ebcf64a9f2b.mp4

Flutter doctor:

[✓] Flutter (Channel dev, 1.26.0-17.1.pre, on macOS 11.1 20C69 darwin-x64, locale pl-PL)
    • Flutter version 1.26.0-17.1.pre at /Users/dominik/fvm/versions/dev
    • Framework revision c40e5294dd (3 days ago), 2021-01-29 08:44:18 -0800
    • Engine revision 5d3477eab4
    • Dart version 2.12.0 (build 2.12.0-259.0.dev)

[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at /Users/dominik/Library/Android/sdk
    • Platform android-30, build-tools 30.0.3
    • ANDROID_HOME = /Users/dominik/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.4, Build version 12D4e
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 4.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)

[✓] VS Code (version 1.52.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.19.0

[✓] Connected device (3 available)
    • iPhone (Dominik) (mobile) • f96e187ec1f51b6be1830c7965a482dc653765d2 • ios            • iOS 14.3
    • macOS (desktop)           • macos                                    • darwin-x64     • macOS 11.1 20C69 darwin-x64
    • Chrome (web)              • chrome                                   • web-javascript • Google Chrome 88.0.4324.96

• No issues found!

orestesgaolin avatar Feb 01 '21 23:02 orestesgaolin