mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
add homepage
This commit is contained in:
48
lib/base/ql_app_bar.dart
Normal file
48
lib/base/ql_app_bar.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class QlAppBar extends StatelessWidget with PreferredSizeWidget {
|
||||
final String title;
|
||||
final List<Widget>? actions;
|
||||
final VoidCallback? backCall;
|
||||
final bool canBack;
|
||||
final Widget? backWidget;
|
||||
|
||||
QlAppBar({
|
||||
Key? key,
|
||||
required this.title,
|
||||
this.actions,
|
||||
this.backCall,
|
||||
this.canBack = true,
|
||||
this.backWidget,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Widget back = backWidget ??
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (backCall != null) {
|
||||
backCall!();
|
||||
}
|
||||
},
|
||||
child: const Center(
|
||||
child: Icon(
|
||||
CupertinoIcons.left_chevron,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
return AppBar(
|
||||
leading: canBack ? back : null,
|
||||
automaticallyImplyLeading: canBack,
|
||||
title: Text(title),
|
||||
centerTitle: true,
|
||||
actions: [...?actions],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||
}
|
||||
Reference in New Issue
Block a user