I am trying to center vertically a child of a container appBar which is text, I am new to flutter so what am I missing here. It is only being centered horizontally
The widget
import 'package:flutter/material.dart';
class MyAppbar extends StatelessWidget implements PreferredSizeWidget {
final Widget title;
const MyAppbar({Key key, this.title}) : super(key: key);
@override
Widget build(BuildContext context) {
return Material(
elevation: 0.0,
color: Colors.white,
child: Container(
padding: const EdgeInsets.all(0.0),
alignment: Alignment.center,
decoration: BoxDecoration(
color: Colors.red,
border: Border(
bottom: BorderSide(
color: Color(0xffd9d9d9),
width: .8,
style: BorderStyle.solid,
),
),
),
child: Center(child: title),
),
);
}
final Size preferredSize = const Size.fromHeight(kToolbarHeight);
}
Where I am calling it
Scaffold(
appBar: MyAppbar(title: Text('Welcome to Ikaze', style: TextStyle(fontSize: 18, fontWeight: FontWeight.w400, color: Colors.black))),
body: Center(),
);