Skip to content

Instantly share code, notes, and snippets.

@hnoor
Last active September 6, 2022 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hnoor/10c83b18a5997886fc1dcf015cfe6796 to your computer and use it in GitHub Desktop.
Save hnoor/10c83b18a5997886fc1dcf015cfe6796 to your computer and use it in GitHub Desktop.
code for custom app bar.
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,
style: TextStyle(color: Colors.black),
),
backgroundColor: Colors.white,
leading: IconButton(
icon: Icon(Icons.chevron_left),
onPressed: () => Navigator.pop(context),
color: Colors.black,
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment