Skip to content

Instantly share code, notes, and snippets.

@WenhaoWu
Last active January 21, 2019 01:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WenhaoWu/e1d3a1710fe9d79adc8398bf6fb59b68 to your computer and use it in GitHub Desktop.
Save WenhaoWu/e1d3a1710fe9d79adc8398bf6fb59b68 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
primarySwatch: Colors.blue,
),
home: new MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Scaffold(
backgroundColor: Colors.black,
body: new DefaultTabController(
length: 3,
child: new CustomScrollView(
slivers: [
new SliverList(
delegate: new SliverChildListDelegate(
<Widget>[
new Container(
color: Colors.grey,
height: 300.0,
),
new TabBar(
tabs: [
new Tab(text: "Tab1"),
new Tab(text: "Tab2"),
new Tab(text: "Tab3"),
],
),
new Container(
height: 200.0,
child: new TabBarView(
children: <Widget>[
new Container(
color: Colors.red,
height: 300.0,
),
new Container(
color: Colors.green,
height: 300.0,
),
new Container(
color: Colors.yellow,
height: 300.0,
),
],
),
)
]
),
)
]
)
)
);
}
}
@ligson
Copy link

ligson commented Jan 21, 2019

如何定义TabBar的height呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment