Created
June 23, 2019 14:28
-
-
Save anzfactory/7275322d8dd6b4c9d2dd7402454febe5 to your computer and use it in GitHub Desktop.
SliverAppBar で minHeight みたいなことしたい場合
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Flutter Demo', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: Scaffold( | |
body: CustomScrollView( | |
slivers: <Widget>[ | |
SliverAppBar( | |
pinned: true, | |
expandedHeight: 200, | |
flexibleSpace: Image.asset('assets/cover.jpg', fit: BoxFit.cover), | |
bottom: PreferredSize(child: Text(''), preferredSize: Size.fromHeight(60),), // これが minHeight の役割をする感じ | |
), | |
SliverList( | |
delegate: SliverChildBuilderDelegate((BuildContext context, int index) { | |
return Container(padding: EdgeInsets.all(16.0), child: Text('Row_$index')); | |
}), | |
) | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment