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

/// 绘本页面的头部组件
class ReadingHeaderWidget extends StatelessWidget {
  const ReadingHeaderWidget({super.key, required this.onTap, this.title = ''});

  final Function() onTap;

  final String title;

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      height: kToolbarHeight,
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          Padding(
            padding: EdgeInsets.only(left: ScreenUtil().bottomBarHeight),
            child: IconButton(
                onPressed: () {
                  onTap();
                },
                icon: Image.asset(
                  'back_around'.assetPng,
                  width: 40.w,
                  height: 40.h,
                )),
          ),
          Container(
            height: 32.h,
            padding: EdgeInsets.symmetric(horizontal: 27.w),
            decoration: BoxDecoration(
              color: const Color(0xFF00B6F1),
              borderRadius: BorderRadius.circular(15.r),
              border: Border.all(
                width: 1.0,
                color: const Color(0xFF140C10),
              ),
            ),
            alignment: Alignment.center,
            child: Text(
              title,
              style: TextStyle(fontSize: 20.sp, color: Colors.white),
            ),
          ),
          ScreenUtil().bottomBarHeight.horizontalSpace,
        ],
      ),
    );
  }
}