practice_header_widget.dart 1.45 KB
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:wow_english/common/extension/string_extension.dart';

class PracticeHeaderWidget extends StatelessWidget {
  const PracticeHeaderWidget({super.key, required this.onTap, this.title = ''});

  final Function() onTap;

  final String title;

  @override
  Widget build(BuildContext context) {
    return Container(
        color: Colors.transparent,
        height: kToolbarHeight + 3.h,
        child: AppBar(
          backgroundColor: Colors.transparent,
          leading: GestureDetector(
            child: Image.asset(
              'back_around'.assetPng,
              width: 40.w,
              height: 40.h,
            ),
            onTap: () => {onTap()},
          ),
          centerTitle: true,
          title: Container(
            height: 20.h,
            width: 100.w, // 容器宽度
            // padding: EdgeInsets.symmetric(horizontal: 27.w, vertical: 10.h),
            alignment: Alignment.center,
            decoration: BoxDecoration(
              color: const Color(0xFF00B6F1),
              borderRadius: BorderRadius.circular(20.r),
              border: Border.all(
                width: 1.0,
                color: const Color(0xFF333333),
              ),
            ),
            child: Text(
              title,
              style: TextStyle(fontSize: 15.sp, color: Colors.white),
            ),
          ),
        ));
  }
}