1+ import 'package:flutter/material.dart' ;
2+
3+ // Show and hide the AppBar depending on show
4+ class CodeJudgeSelectionAppBar extends StatelessWidget implements PreferredSizeWidget {
5+ final String title;
6+ final bool show;
7+ final VoidCallback onClosePressed;
8+ final VoidCallback onUploadPressed;
9+ final VoidCallback onDeletePressed;
10+ final List <Widget >? actions;
11+
12+ const CodeJudgeSelectionAppBar ({
13+ super .key,
14+ required this .show,
15+ required this .title,
16+ required this .onClosePressed,
17+ required this .onUploadPressed,
18+ required this .onDeletePressed,
19+ this .actions,
20+ });
21+
22+ @override
23+ Widget build (BuildContext context) {
24+ return AnimatedSwitcher (
25+ duration: Duration (milliseconds: 250 ),
26+ child: show
27+ ? AppBar (
28+ title: Text (title),
29+ backgroundColor: Theme .of (context).colorScheme.primary,
30+ foregroundColor: Theme .of (context).scaffoldBackgroundColor,
31+ leading: IconButton (
32+ onPressed: onClosePressed,
33+ icon: Icon (Icons .close_outlined),
34+ ),
35+ actions: [
36+ IconButton (
37+ onPressed: onUploadPressed,
38+ icon: Icon (Icons .upload_file_outlined),
39+ ),
40+ // Button to delete all selected exercises
41+ IconButton (
42+ onPressed: onDeletePressed,
43+ icon: Icon (Icons .delete_forever_outlined),
44+ ),
45+ ],
46+ )
47+ : SizedBox .shrink ()
48+ );
49+ }
50+
51+ @override
52+ Size get preferredSize => Size .fromHeight (kToolbarHeight);
53+ }
0 commit comments