Skip to content

Instantly share code, notes, and snippets.

@derekedelaney
Last active September 2, 2021 19:13
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 derekedelaney/a455230297428367c63aeaf8cbea0ad8 to your computer and use it in GitHub Desktop.
Save derekedelaney/a455230297428367c63aeaf8cbea0ad8 to your computer and use it in GitHub Desktop.
Flutter tabs overflow accessibility issue
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
tabBarTheme: TabBarTheme(
labelColor: Colors.black,
labelStyle: TextStyle(fontSize: 75),
),
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatelessWidget {
final String title;
const MyHomePage({
Key? key,
required this.title,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(title),
),
body: Column(
children: [
DefaultTabController(
length: 3,
child: TabBar(
tabs: [
Tab(
icon: Icon(Icons.directions_car),
text: 'Tab 1',
),
Tab(
icon: Icon(Icons.directions_transit),
text: 'Tab 2',
),
Tab(
icon: Icon(Icons.directions_bike),
text: 'Tab 2',
),
],
),
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment