mirror of
https://bitbucket.org/myhomie/myhomie_app.git
synced 2025-12-06 17:11:19 +00:00
77 lines
2.4 KiB
Dart
77 lines
2.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:myhomie_app/Models/homieContext.dart';
|
|
import 'package:myhomie_app/app_context.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class CustomAppBar extends StatefulWidget implements PreferredSizeWidget {
|
|
CustomAppBar({Key? key, required this.title, this.titleIcon, this.isTextSizeButton});
|
|
|
|
final String title;
|
|
final IconData? titleIcon;
|
|
bool? isTextSizeButton = false;
|
|
final double _preferredHeight = 50;
|
|
|
|
@override
|
|
State<CustomAppBar> createState() => _CustomAppBarState();
|
|
|
|
@override
|
|
Size get preferredSize => Size.fromHeight(_preferredHeight);
|
|
}
|
|
|
|
class _CustomAppBarState extends State<CustomAppBar> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final appContext = Provider.of<AppContext>(context);
|
|
HomieAppContext homieAppContext = appContext.getContext();
|
|
|
|
final notchInset = MediaQuery.of(context).padding;
|
|
return AppBar(
|
|
title: Row(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text(widget.title),
|
|
Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: widget.titleIcon != null ? Icon(widget.titleIcon) : null,
|
|
),
|
|
],
|
|
),
|
|
centerTitle: true,
|
|
/*leading: widget.isHomeButton ? IconButton(
|
|
icon: const Icon(Icons.home),
|
|
onPressed: () {
|
|
// Set new State
|
|
setState(() {
|
|
visitAppContext.configuration = null;
|
|
visitAppContext.isScanningBeacons = false;
|
|
//Navigator.of(context).pop();
|
|
Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(
|
|
builder: (context) => const HomePage(),
|
|
),(route) => false);
|
|
});
|
|
}
|
|
) : null,*/
|
|
actions: [
|
|
],
|
|
flexibleSpace: Container(
|
|
decoration: const BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.centerRight,
|
|
end: Alignment.centerLeft,
|
|
colors: [
|
|
/*Color(0xFFDD79C2),
|
|
Color(0xFFB65FBE),
|
|
Color(0xFF9146BA),
|
|
Color(0xFF7633B8),
|
|
Color(0xFF6528B6),
|
|
Color(0xFF6025B6)*/
|
|
Color(0xFF306bac),
|
|
Color(0xFF308aae),
|
|
Color(0xFF309cb0),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |