File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed
Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change 1+ import 'package:flutter/material.dart' ;
2+
3+ class CodeJudgeTaskBox extends StatelessWidget {
4+ final Widget child;
5+ final String task;
6+ final VoidCallback ? onButtonPressed;
7+ final bool showButton;
8+ final IconData ? buttonIcon;
9+
10+ const CodeJudgeTaskBox ({
11+ super .key,
12+ required this .child,
13+ required this .task,
14+ this .onButtonPressed,
15+ this .showButton = false ,
16+ this .buttonIcon,
17+ });
18+
19+ @override
20+ Widget build (BuildContext context) {
21+ final theme = Theme .of (context);
22+
23+ return Expanded (
24+ child: SingleChildScrollView (
25+ padding: const EdgeInsets .all (16 ),
26+ child: Column (
27+ children: [
28+ // Draw a nice box containing a button and the task
29+ Container (
30+ width: double .infinity,
31+ padding: const EdgeInsets .all (16 ),
32+ decoration: BoxDecoration (
33+ color: theme.colorScheme.surfaceContainerHigh,
34+ borderRadius: BorderRadius .circular (12 ),
35+ border: Border .all (color: theme.colorScheme.outline, width: 1 ),
36+ ),
37+ child: Row (
38+ spacing: 16 ,
39+ children: [
40+ // Display the task
41+ Expanded (
42+ child: Text (
43+ task,
44+ softWrap: true ,
45+ ),
46+ ),
47+ // Display a button with the correct icon
48+ showButton
49+ ? FloatingActionButton .small (
50+ heroTag: "hint" ,
51+ onPressed: onButtonPressed,
52+ child: Icon (buttonIcon)
53+ )
54+ : SizedBox .shrink (),
55+ ],
56+ ),
57+ ),
58+ // Display the child
59+ child,
60+ ],
61+ ),
62+ ),
63+ );
64+ }
65+ }
You can’t perform that action at this time.
0 commit comments