How To Change Text Size Tabbar Using Flutter Android App

admin_img Posted By Bajarangi soft , Posted On 30-10-2020

You can change the font size of text in a Text Widget using style property.Create a TextStyle object with fontSize and specify this object as style for Text Widget.

How To Change Text Size Tabbar Using Flutter Android App

Change Text Size Tabbar
Complete Code For In Change Text Size Tabbar Flutter
main.dart

import 'package:flutter/material.dart';

void main(){
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {

  @override
  MyHomePageState createState() {
    return new MyHomePageState();
  }

}

class MyHomePageState extends State<MyHomePage> {
  bool Small = false;

  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
      length: 2,
      child: Scaffold(
        appBar: AppBar(
          backgroundColor: Colors.orange,
          title: Text("Change Text Size Tabbar"),
          bottom: TabBar(
            labelStyle: TextStyle(fontSize: Small ? 13.0 : 22.0),
            tabs: <Widget>[
              Tab(
                text: "First Tab",
              ),
              Tab(
                text: "Second Tab",
              ),
            ],
          ),
        ),
        body: TabBarView(
          children: <Widget>[
            Center(
              child: RaisedButton(
                onPressed: () => setState(() => Small = !Small),
                child: Text(Small ? 'Make font Big' : 'Make font Small',style: TextStyle(color: Colors.white),),
                color: Colors.orange,
              ),
            ),
            Center(
              child: RaisedButton(
                onPressed: () => setState(() => Small = !Small),
                child: Text(Small ? 'Make font Big' : 'Make font Small',style: TextStyle(color: Colors.white)),
                color: Colors.orange,
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Related Post