How do I use a large title Navigation Bar in Flutter?

Issue

This is what I get when I use CupertinoNavigationBar()

Standard title Navigation Bar –
Standard title Navigation Bar

This is what I need to implement –
Large title Navigation Bar

Solution

You can checkout this tutorial for the explanation but the code from the tutorial is:

import 'package:flutter/cupertino.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 CupertinoApp(
      title: 'Flutter Demo',
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget{
  @override
  Widget build(BuildContext context) {
    return CupertinoPageScaffold(
      child: NestedScrollView(
        headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled){
          return <Widget>[
            CupertinoSliverNavigationBar(
              largeTitle: Text('Settings'),
            )
          ];
        },
        body: Center(child: Text('Home Page'),),
      ),
    );
  }
}

This code makes a large text an appbar with a large title like the following image:

Appbar image

Answered By – Morez

Answer Checked By – Terry (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.