1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- /// 页顶导航条
- class VAppBar extends AppBar {
- /// 标题文字
- final String? titleText;
- /// 标题组件
- final Widget? titleWidget;
- /// 右侧组件组
- @override
- final List<Widget>? actions;
- final BuildContext? context;
- final VoidCallback? iconBack;
- VAppBar({
- super.key,
- this.titleText,
- this.titleWidget,
- this.actions,
- this.context,
- this.iconBack,
- }) : super(
- elevation: 0,
- scrolledUnderElevation: 0,
- toolbarHeight: 60,
- backgroundColor: Colors.white,
- foregroundColor: Colors.green,
- flexibleSpace: Builder(builder: (context) {
- return Container(
- decoration: BoxDecoration(
- gradient: LinearGradient(
- colors: [
- Theme.of(context).primaryColor.withOpacity(.6),
- Theme.of(context).primaryColor,
- ],
- begin: Alignment.topRight,
- end: Alignment.bottomLeft,
- ),
- ),
- );
- }),
- leadingWidth: 88,
- leading: InkWell(
- onTap: () {
- iconBack?.call();
- Get.back();
- },
- child: SizedBox(
- width: 88,
- height: 60,
- child: Icon(
- Icons.arrow_back_ios_new,
- size: 36,
- color: Colors.white,
- ),
- ),
- ),
- centerTitle: true,
- titleTextStyle: const TextStyle(fontSize: 24),
- title: titleWidget ?? Text(titleText!),
- actions: actions,
- actionsIconTheme: const IconThemeData(size: 68, color: Colors.white),
- );
- }
|