Blame view

lib/common/widgets/we_app_bar.dart 1.26 KB
2a29701f   liangchengyou   feat:提交代码
1
  import 'package:flutter/material.dart';
60e47f7c   liangchengyou   feat:课程选择功能
2
  import 'package:wow_english/common/extension/string_extension.dart';
2a29701f   liangchengyou   feat:提交代码
3
4
5
6
7
8
9
  
  class WEAppBar extends StatelessWidget implements PreferredSizeWidget {
    final String? titleText;
    final bool? centerTitle;
    final VoidCallback? onBack;
    final Color? backgroundColor;
    final PreferredSizeWidget? bottom;
60e47f7c   liangchengyou   feat:课程选择功能
10
11
    final Widget? leading;
    final List<Widget>? actions;
2a29701f   liangchengyou   feat:提交代码
12
13
14
15
16
17
    const WEAppBar({
      this.titleText,
      this.centerTitle = true,
      this.onBack,
      this.backgroundColor,
      this.bottom,
60e47f7c   liangchengyou   feat:课程选择功能
18
19
      this.leading,
      this.actions,
2a29701f   liangchengyou   feat:提交代码
20
21
22
23
24
25
26
      super.key});
  
    @override
    Widget build(BuildContext context) {
      return AppBar(
        centerTitle: centerTitle,
        title: Text(titleText??''),
60e47f7c   liangchengyou   feat:课程选择功能
27
28
29
30
31
32
33
        leading: leading??GestureDetector(
          onTap: () {
            Navigator.pop(context);
          },
          child: Container(
            alignment: Alignment.center,
            child: Image.asset(
d35a4e87   liangchengyou   feat:磨耳朵功能UI
34
35
36
              'back_around'.assetPng,
              height: 40,
              width: 40,
60e47f7c   liangchengyou   feat:课程选择功能
37
38
39
40
41
            ),
          ),
        ),
        backgroundColor: backgroundColor??Colors.white,
        actions: actions??[],
2a29701f   liangchengyou   feat:提交代码
42
43
44
45
46
47
48
49
      );
    }
  
    @override
    // TODO: implement preferredSize
    Size get preferredSize => Size.fromHeight(
        kToolbarHeight + (bottom == null ? 0.0 : bottom!.preferredSize.height));
  }