Skip to content

Instantly share code, notes, and snippets.

@anzfactory
Created June 23, 2019 14:28
Show Gist options
  • Save anzfactory/7275322d8dd6b4c9d2dd7402454febe5 to your computer and use it in GitHub Desktop.
Save anzfactory/7275322d8dd6b4c9d2dd7402454febe5 to your computer and use it in GitHub Desktop.
SliverAppBar で minHeight みたいなことしたい場合
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