Created
July 6, 2022 13:04
-
-
Save IsmailAlamKhan/d3d2379702d3b3856e4ef4d1a7217e20 to your computer and use it in GitHub Desktop.
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 'dart:math'; | |
import 'package:flutter/material.dart'; | |
void main() => runApp(const MyApp()); | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return const MaterialApp( | |
title: 'Material App', | |
home: Home(), | |
); | |
} | |
} | |
final random = Random(); | |
class Home extends StatelessWidget { | |
const Home({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return DefaultTabController( | |
length: 3, | |
child: Scaffold( | |
drawer: const Drawer(), | |
appBar: AppBar(), | |
body: NestedScrollView( | |
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) { | |
return <Widget>[ | |
SliverList( | |
delegate: SliverChildListDelegate( | |
[ | |
Container(color: Colors.red, height: 100), | |
Container(color: Colors.blue, height: 100), | |
Container(color: Colors.green, height: 100), | |
Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: Material( | |
color: Colors.black, | |
child: TabBar( | |
tabs: [ | |
'Tab 1', | |
'Tab 2', | |
'Tab 3', | |
].map((e) => Tab(text: e)).toList(), | |
), | |
), | |
), | |
], | |
), | |
), | |
]; | |
}, | |
body: TabBarView( | |
children: [ | |
'Tab 1', | |
'Tab 2', | |
'Tab 3', | |
].map( | |
(e) { | |
return Center(child: Text(e)); | |
}, | |
).toList(), | |
), | |
)), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment