Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import 'package:flutter/material.dart';
import 'package:flutter_custom_toolbox/flutter_toolbox.dart';
import 'package:suguru/cubit/activity/activity_cubit.dart';
import 'package:suguru/models/activity/cell.dart';
import 'package:suguru/models/activity/cell_location.dart';
import 'package:suguru/models/activity/activity.dart';
import 'package:suguru/ui/widgets/game/cell_update.dart';
class SelectCellValueBar extends StatelessWidget {
const SelectCellValueBar({super.key});
@override
Widget build(BuildContext context) {
return BlocBuilder<ActivityCubit, ActivityState>(
builder: (BuildContext context, ActivityState activityState) {
final Activity activity = activityState.currentActivity;
final bool isUpdatableCellSelected =
(activity.selectedCell != null) ? !activity.selectedCell!.isFixed : false;
final int maxValue =
activity.board.getMaxValueForBlock(activity.selectedCell?.blockId);
const int fixedItemsCountPerLine = 6;
return Container(
margin: const EdgeInsets.all(2),
padding: const EdgeInsets.all(2),
child: Table(
defaultColumnWidth: const IntrinsicColumnWidth(),
children: [
TableRow(
children: [
for (int value = 0; value < fixedItemsCountPerLine; value++)
Column(
children: [
CellWidgetUpdate(
cell: Cell(
location: CellLocation.go(1, value),
blockId: '',
value:
isUpdatableCellSelected ? (value <= maxValue ? value : 0) : -1,
isFixed: false,
),
),
],
),
],
),
],
),
);
},
);
}
}