Last active
April 13, 2021 04:14
-
-
Save vi-k/126a26d441fa2fa757cdc7642d7a99b2 to your computer and use it in GitHub Desktop.
TabBar - custom ripple effect
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(TabBarDemo()); | |
} | |
class TabBarDemo extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: DefaultTabController( | |
length: 2, | |
child: Scaffold( | |
appBar: AppBar( | |
bottom: PreferredSize( | |
preferredSize: Size.fromHeight(40), | |
child: Material( | |
color: Colors.transparent, | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.circular( | |
20, | |
), | |
), | |
clipBehavior: Clip.antiAlias, | |
child: TabBar( | |
tabs: [ | |
Tab(icon: Icon(Icons.directions_car)), | |
Tab(icon: Icon(Icons.directions_transit)), | |
], | |
), | |
), | |
), | |
title: Text('Tabs Demo'), | |
), | |
body: TabBarView( | |
children: [ | |
Icon(Icons.directions_car), | |
Icon(Icons.directions_transit), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment