how to customize app bar in flutter code example
Example: flutter create custom appbar
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(
title: Text('$_title'),
centerTitle: true,
backgroundColor: Colors.black54,
);
}
}
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'),
);
}
}