flutter custom appbar

// ./components/appBar.dart
import 'package:flutter/material.dart';

class CustomAppBar extends StatelessWidget with PreferredSizeWidget {
  final String _title;

  @override
  final Size preferredSize;

  CustomAppBar(this._title, { Key key}) : preferredSize = Size.fromHeight(50.0),
        super(key: key);

  @override
  Widget build(BuildContext context) {
    return AppBar( // your customization here
      title: Text('$_title'),
      centerTitle: true,
      backgroundColor: Colors.black54,
    );
  }
}

// on the file using the appBar just: 

import 'package:flutter/material.dart';
import 'package:photo_app/components/appBar.dart';

class Albums extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: CustomAppBar('Your title here'),
    );
  }
}

4
4
Awgiedawgie 440215 points

                                    Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('AppBar Title', textAlign: TextAlign.center),
      ),

4 (4 Votes)
0
3.5
8
Awgiedawgie 440215 points

                                    class Sample1 extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        drawer: Drawer(),
        appBar: MyCustomAppBar(
          height: 150,
        ),
        body: Center(
          child: FlutterLogo(
            size: MediaQuery.of(context).size.width / 2,
          ),
        ),
      ),
    );
  }
}

class MyCustomAppBar extends StatelessWidget implements PreferredSizeWidget {
  final double height;

  const MyCustomAppBar({
    Key key,
    @required this.height,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Container(
          color: Colors.grey[300],
          child: Padding(
            padding: EdgeInsets.all(30),
            child: AppBar(
                    title: Container(
                      color: Colors.white,
                      child: TextField(
                        decoration: InputDecoration(
                          hintText: "Search",
                          contentPadding: EdgeInsets.all(10),
                        ),
                      ),
                    ),
                    actions: [
                      IconButton(
                        icon: Icon(Icons.verified_user),
                        onPressed: () => null,
                      ),
                    ],
                  ) ,
          ),
        ),
      ],
    );
  }
  
 @override
  Size get preferredSize => Size.fromHeight(height);
}

3.5 (8 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
flutter appbar styling use of appbar in flutter how to use a custom appbar flutter how to add widgets under appbar flutter make app bar widget flutter appbar ui flutter appbar flutter ui widget in appbar flutter how to call widget in appbar flutter create a appbar flutter appbar widget add custom appbar in Flutter customize appbar flutter app bar flutter Custominze app bar in flutter make custom app bar flutter how to make a custom appbar flutter appbar flutter add widget at appbar flutter Flutter custom appbar class dart custom appbar flutter appbar with custom flutter appbar custom widget flutter flutter 2 custom appbar custom appbar code in flutter custom, app bar flutter package for appBar in flutter flutter add widget below appbar how to use appbar in flutter "appbar widget flutterant" flutter style AppBar how to apply appbar in flutter dart appbar what is appbar in flutter custom app bar style flutter appBar as container in flutter flutter appBar class how to make an appbar in flutter custome appbar widget how to customise the appbar flutte appbar custom flutter app bar customize flutter top of the appbar in flutter Flutter creating a custom AppBar custom appbar in flutter pub appbar flutter flutter app bar "actions" in custom appbar flutter app bar actions in custom appbar flutter how to design appbar in flutter how to take appbar in flutter how to design a appbar in flutter list of appbar flutter design of Appbar in flutter appbar flutter design how to design custom app bar in flutter create custom appbar widgets in flutter flutter appbar as widget appbar flutter examples flutter appbar components appbar in fluuter how to make an appbar flutter Flutter how to customise the AppBar adding widgets to appbar in flutter how to custom app bar flutter what is the AppBar in flutter flutter designing custom appbar flutter documentation appbar flutter appbar through custom widget appbar documentation flutter appbar widget flutter FLUTTER APPbAR TYPES app bar customizations flutter custom container in appbar flutter custom appbar flutter appbar flutter package appbar menu flutter fluter appbar make appbar in flutter flutter materialapp appbar flutter page with appbar cool appbar flutter flutter create appbar widget how to make a good appbar in flutter appbar component flutter create custom Appbar fluuter flutter appbabar widget flutter appbar documentation docs flutter appbar custom appbar widget flutter widget under appbar flutter flutter setup appbar flutter appbar toolbar flutter material app appbar appbar over flutter flutter widget appbar how to create custom appbar in flutter flutter appbar menu flutter material appbar custom flutter material appbar code example flutter appbar how to make custom appbar in deferent dart file in flutter appbar widget in flutter add widget in appbar in flutter customized appbar flutter flutter customize appbar which widget is used to create a appbar flutter which widget is used to create an appbar flutter appbar widget alon flutter how to create appbar in flutter AppBar class flutter appbar design in flutter appbar flutter documentation call appbar flutter widget create appbar widget in flutter and call it creat appbar widget alon flutter create appbar in flutter appbar(). flutter flutter myApp appBar flutter appbar methods Flutter customize app bar flutter appbar tutorial appbar flutter custom appbar design flutter how to add appbar in flutter 5 ways to customise appbar flutter flutter appbar component how to make custom appbar flutter how to make custom app bar flutter flutter appbar customization make a custom app bar in flutter add widget in appbar flutter how to create a custom app bar in flutter flutter appbar container appbar setting ui flutter app bar flutter UI appbar flutter actions appbar flutter appbar impleding false flutter flutter appBar appbar flutterr flutter bar actions flutter better appbar appbar modification image and text appbar material ui flutter Custom appbar in flutter how to custom the icon in flutter appbar appbar properties flutter appbar example flutter app bars on flutter appbar in flutter flutter display widget at end of appbar how to custom the bottomappbar in flutter AppBar property that allows you to specify the title of your application flutter add custom appbar flutter bar widget custom tool bar flutter widget appbar flutter appbar end flutter before appbar AppBarin flutter actions in appbar flutter flutter appbar scaffold flutter appbar usage flurer appbar flutter extended appbar scaffold app bar flutter appbar design app bar dart preferredsizewidget appbar flutter app bar styling flutter flutter make generic app bar flutter append widget to listview builder flutter appBar attri# appbar menu flutter ui appbar in flutter example actions appbar custom icon flutter scaffold custom appbar use a container in appbar flutter flutter appbar secondary customize appbar in flutter flutter appbare how to add appbar in materialapp flutter flutter body with container like appbar flutter appbar end how to make custom appbar in flutter material appbar flutter Insert widgets at appbar plus_one_sharp icon in appbar flutter plus_one_sharp icon in app bar flutter should I use custom appbar or material app bar in flutter appbar flutter code flutter preferred size custom appbar flutter custom appbar widget flutter custom app bar widget appbar example flutter code flutter appbar docs flutter custom appbar flutter sliver appbar custom flutter different types of appbars style appbar flutter how to access flutter appbar component use custom appbar flutter build appbar in flutter toolbar in flutter app bar actions flutter types of appbar flutter custom app bar how to show user on appbar flutter appBar fllutter flutter widget inside appBar flutter add more items on appbar appbar properties in flutter flutter appbar code app bar properties in flutter app bar flutter structure app bar structure flutter flutter top bar how to make and appbar in dart flutter appbar actions how to make appbar in flutter appbar actions in flutter flutter custom toolbar how to do an custon appbar flutter appbar flutter docs what is app bar in flutter material app bar flutter appbar properties flutter docs appbar how to customize app bar in flutter how give custom icon in app bar in flutter add elements to the app bar flutter flutter get appbar properties app bar action liosts in flutter app bar widget flutter flutter app bar positioning flutter topbar flutter app bar child skill bar flutter appbar flutter example material ui flutter appbar custom left action app bar in flutter create custom app bar flutter flutter app header bar appbar leading how to insert names in appbar flutter flutter appbar custom title bar in flutter example appbar flutter possible elements appBar: AppBar() flutter flutter appbar trailing flutter appbar properties how make cool app bar flutter appbar with flexibleScape flutter appbar flutter doc futter AppBar appbar actions flutter custom appbar flutte flutter add appbar column in toolbar action flutter make content in appbar flutter appbar difference title flutter custumize AppBar in flutter can we assign appBar property custom made widget create custom appbar flutter AppBar flutter detail flutter appbar style have app bar in app bar appbar flutter appbar flutter example custom silver app bar flutter flutter apbar customse appbar Title use container as appbar flutter appbar actions in mainaxies alien maine flutter bar flutter app bar icons appbar flutter app bar how to customize appbar in flutter app bar flutter creating custom app bar in flutter custome widget app bar custom app bar flutter widget in between appbar flutter flutter appbar example custom appbar flutter custom appbar Appbar flutter create costum create costum appbar Appbar flutter create custom flutter how make widget appbar flutter appbar widget how to customize an appbar customized app bar in flutter custom app bar examples flutter how to add widgets in an appbar in flutter completly custmo appbar using glutter flutter custom title flutter custom appbar flutter create custom appbar
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source