75 lines
2.0 KiB
Dart
75 lines
2.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:remixicon/remixicon.dart';
|
|
|
|
class TopBar extends StatelessWidget implements PreferredSizeWidget {
|
|
const TopBar({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
//标题子显示内容
|
|
Widget infoItem({required String title, required IconData icon}) {
|
|
return Row(
|
|
spacing: 4,
|
|
children: [
|
|
Icon(icon, color: Colors.white54, size: 14),
|
|
Text(
|
|
title,
|
|
style: TextStyle(fontSize: 12, color: Colors.white54),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
//操作按钮
|
|
Widget actionButton({required IconData icon, required String title}) {
|
|
return Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
|
|
margin: EdgeInsets.only(right: 15),
|
|
decoration: BoxDecoration(
|
|
color: Color(0xff4a4f4f),
|
|
borderRadius: BorderRadius.circular(8),
|
|
),
|
|
child: Row(
|
|
spacing: 8,
|
|
children: [
|
|
Icon(icon, size: 16),
|
|
Text(title, style: TextStyle(fontSize: 14)),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
return AppBar(
|
|
backgroundColor: Color(0xff373c3e),
|
|
foregroundColor: Colors.white,
|
|
title: Column(
|
|
spacing: 5,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text("高三数学重置版", style: TextStyle(color: Colors.white, fontSize: 18)),
|
|
Row(
|
|
spacing: 15,
|
|
children: [
|
|
infoItem(title: "剩余 1小时23分钟", icon: RemixIcons.time_line),
|
|
infoItem(title: "8 名学生", icon: RemixIcons.group_line),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
actions: [
|
|
actionButton(
|
|
icon: RemixIcons.video_on_ai_line,
|
|
title: "关闭全部",
|
|
),
|
|
actionButton(
|
|
icon: RemixIcons.volume_up_line,
|
|
title: "全部静音",
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
@override
|
|
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
|
}
|