Skip to content

Instantly share code, notes, and snippets.

@vi-k
Last active April 13, 2021 04:14
Show Gist options
  • Save vi-k/126a26d441fa2fa757cdc7642d7a99b2 to your computer and use it in GitHub Desktop.
Save vi-k/126a26d441fa2fa757cdc7642d7a99b2 to your computer and use it in GitHub Desktop.
TabBar - custom ripple effect
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