Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Wrapping CupertinoListTile with SizeTransition removes the divider #7

Open
MarsGoatz opened this issue Nov 18, 2020 · 0 comments
Open

Comments

@MarsGoatz
Copy link

MarsGoatz commented Nov 18, 2020

I have a use case to hide the CupertinoListTile and when wrapping the CupertinoListTile with SizeTransition, the divider is no longer visible. The workaround is to wrap the tile with a Container and provide explicit height but this leads to gaps between the tiles which unfortunately degrades the aesthetics of the CupertinoListTile.

Example

import 'package:cupertino_list_tile/cupertino_list_tile.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      localizationsDelegates: <LocalizationsDelegate<dynamic>>[
        DefaultMaterialLocalizations.delegate,
        DefaultWidgetsLocalizations.delegate,
        DefaultCupertinoLocalizations.delegate,
      ],
      title: 'Cupertino List Divider Test',
      theme: CupertinoThemeData(brightness: Brightness.dark),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> with TickerProviderStateMixin {
  @override
  Widget build(BuildContext context) {
    var controller = AnimationController(
      duration: Duration.zero,
      vsync: this,
    )..forward();

    var animation = CurvedAnimation(
      parent: controller,
      curve: Curves.linear,
    );

    return CupertinoPageScaffold(
      navigationBar: CupertinoNavigationBar(
        middle: Text('Cupertino List Divider Test'),
      ),
      child: ListView.builder(
        itemCount: 10,
        itemBuilder: (context, index) {
          return SizeTransition(
            sizeFactor: animation,
            child: CupertinoListTile(
              title: Center(child: Text(index.toString())),
            ),
          );
        },
      ),
    );
  }
}

Flutter Doctor

[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0.1 20B29 darwin-x64, locale en-CA)
• Flutter version 1.22.4 at /Users/sid/Work/Software/Flutter/flutter
• Framework revision 1aafb3a8b9 (4 days ago), 2020-11-13 09:59:28 -0800
• Engine revision 2c956a31c0
• Dart version 2.10.4

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/sid/Work/Software/Flutter/android
• Platform android-30, build-tools 29.0.2
• ANDROID_HOME = /Users/sid/Work/Software/Flutter/android
• 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-6222593)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 12.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.1, Build version 12A7403
• CocoaPods version 1.10.0

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

Screenshot

Simulator Screen Shot - iPhone 12 Pro - 2020-11-17 at 16 28 23

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant