You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
1.8 KiB
63 lines
1.8 KiB
import 'package:flutter/material.dart'; |
|
|
|
class SlimAppBar extends StatelessWidget { |
|
final String title; |
|
final double size; |
|
// final Function onBackTap; |
|
|
|
const SlimAppBar({ |
|
required this.title, |
|
this.size = 24, |
|
// this.onBackTap, |
|
super.key, |
|
}); |
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
return SizedBox( |
|
width: double.infinity, |
|
height: size, |
|
child: Container( |
|
color: |
|
Theme.of(context).appBarTheme.backgroundColor ?? |
|
Theme.of(context).primaryColor, |
|
child: InkWell( |
|
onTap: (ModalRoute.of(context)?.canPop ?? false) |
|
? () => Navigator.of(context).pop() |
|
: null, |
|
child: Row( |
|
mainAxisSize: MainAxisSize.max, |
|
crossAxisAlignment: CrossAxisAlignment.stretch, |
|
children: <Widget>[ |
|
SizedBox( |
|
height: size, |
|
width: size, |
|
child: (ModalRoute.of(context)?.canPop ?? false) |
|
? const BackButtonIcon() |
|
: null, |
|
), |
|
Expanded( |
|
child: Center( |
|
child: Padding( |
|
padding: const EdgeInsets.all(2), |
|
child: Text( |
|
title, |
|
textAlign: TextAlign.center, |
|
style: |
|
Theme.of(context).appBarTheme.textTheme?.bodySmall?.copyWith(color: Theme.of(context).appBarTheme.textTheme?.bodyMedium?.color) ?? |
|
Theme.of(context).textTheme.bodySmall?.copyWith(color: Theme.of(context).textTheme.bodyMedium?.color), |
|
), |
|
), |
|
), |
|
), |
|
SizedBox( |
|
height: size, |
|
width: size, |
|
), |
|
], |
|
), |
|
), |
|
), |
|
); |
|
} |
|
}
|
|
|