Created the custom app bar for screens different than home

This commit is contained in:
Mariano Uvalle 2019-03-31 16:55:54 -06:00
parent 8b3bd37df7
commit 3ac4e919c0
2 changed files with 57 additions and 1 deletions

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import '../blocs/new_task_bloc.dart';
import '../widgets/custom_app_bar.dart';
class NewTaskScreen extends StatefulWidget {
@override
@ -11,6 +12,10 @@ class _NewTaskScreenState extends State<NewTaskScreen> {
final NewTaskBloc bloc = NewTaskBloc();
Widget build(BuildContext context) {
return Scaffold();
return Scaffold(
appBar: CustomAppBar(
title: 'Add task',
),
);
}
}

View file

@ -0,0 +1,51 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
final String title;
CustomAppBar({this.title = ''});
Widget build(BuildContext context) {
return Material(
elevation: 10.0,
child: Container(
color: Theme.of(context).canvasColor,
child: SafeArea(
child: Container(
height: preferredSize.height,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
IconButton(
icon: Icon(
FontAwesomeIcons.arrowLeft,
color: Color.fromRGBO(112, 112, 112, 1),
),
onPressed: () => Navigator.of(context).pop(),
),
SizedBox(
height: 10,
),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: Text(
title,
style: TextStyle(
fontSize: 40,
fontWeight: FontWeight.w700,
color: Colors.white,
),
),
),
],
),
),
),
),
);
}
@override
final preferredSize = Size.fromHeight(140.0);
}