1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import 'package:flutter/material.dart';
- import 'package:get/get.dart';
- /// 页顶导航条
- class VAppBar extends AppBar {
- /// 标题文字
- final String? titleText;
- /// 标题组件
- final Widget? titleWidget;
- /// 右侧组件组
- final List<Widget>? actions;
- VAppBar({
- super.key,
- this.titleText,
- this.titleWidget,
- this.actions,
- }) : super(
- toolbarHeight: 90,
- backgroundColor: Colors.blue,
- foregroundColor: Colors.green,
- flexibleSpace: Container(
- decoration: const BoxDecoration(
- gradient: LinearGradient(
- colors: [
- Color.fromRGBO(59, 188, 255, 1),
- Color.fromRGBO(44, 120, 229, 1),
- ],
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- ),
- ),
- ),
- leadingWidth: 100,
- leading: IconButton(
- icon: const Icon(
- Icons.arrow_back_rounded,
- size: 68,
- color: Colors.white,
- ),
- onPressed: () {
- Get.back();
- },
- ),
- centerTitle: true,
- titleTextStyle: const TextStyle(fontSize: 24),
- title: titleWidget ?? Text(titleText!),
- actions: actions,
- actionsIconTheme: const IconThemeData(size: 68, color: Colors.white),
- );
- }
|