Skip to content

Commit fdc7893

Browse files
committed
Merge branch 'develop'
2 parents 0b2b492 + cc82a19 commit fdc7893

25 files changed

+377
-238
lines changed

analysis_options.yaml

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
include: package:flutter_lints/flutter.yaml
1111

1212
analyzer:
13-
exclude: [lib/**.freezed.dart, lib/**.g.dart]
13+
exclude:
14+
- lib/**.freezed.dart
15+
- lib/**.g.dart
16+
- lib/l10n/gen
1417

1518
linter:
1619
# The lint rules applied to this project can be customized in the
@@ -29,6 +32,7 @@ linter:
2932
prefer_final_locals: true
3033
# prefer_final_parameters: true
3134
prefer_final_in_for_each: true
35+
always_declare_return_types: true
3236
# avoid_print: false # Uncomment to disable the `avoid_print` rule
3337
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
3438
# Additional information about this file can be found at

lib/cook_page/recipe_card/default_recipe_card.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DefaultRecipeCard extends StatelessWidget {
3535
mainAxisSize: MainAxisSize.min,
3636
spacing: spacing,
3737
children: <Widget>[
38-
_TitleBox(keepKoreanWord(L10ns.of(context).localized('${recipe.code}_name'))),
38+
_TitleBox(L10ns.of(context).localized('${recipe.code}_name').untruncatedKoreanByNewline),
3939
Image.asset(
4040
'assets/images/items/${recipe.assetName}.png',
4141
width: imageSize,

lib/cook_page/recipe_card/detail_recipe_card.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class DetailRecipeCard extends StatelessWidget {
3535
mainAxisSize: MainAxisSize.min,
3636
spacing: spacing,
3737
children: <Widget>[
38-
_TitleBox(keepKoreanWord(L10ns.of(context).localized('${recipe.code}_name'))),
38+
_TitleBox(L10ns.of(context).localized('${recipe.code}_name').untruncatedKoreanByNewline),
3939
Image.asset(
4040
'assets/images/items/${recipe.assetName}.png',
4141
width: imageSize,

lib/cook_page/recipe_card/simple_recipe_card.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class SimpleRecipeCard extends StatelessWidget {
3333
mainAxisSize: MainAxisSize.min,
3434
spacing: spacing,
3535
children: <Widget>[
36-
_TitleBox(keepKoreanWord(L10ns.of(context).localized('${recipe.code}_name'))),
36+
_TitleBox(L10ns.of(context).localized('${recipe.code}_name').untruncatedKoreanByNewline),
3737
Image.asset(
3838
'assets/images/items/${recipe.assetName}.png',
3939
width: imageSize,

lib/farm_page/edit_farm_set/components/analysis_view/nutrient_condition_box.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,7 @@ class NutrientConditionBox extends StatelessWidget {
124124
phrases += [
125125
FittedBox(
126126
child: Text(
127-
// TODO: Localize this string
128-
'각 성장마다 선택한 비료를 $countOfNeededFertilizer번 사용해야 합니다.',
127+
L10ns.of(context).nutrientConditionBox.secondaryText(countOfNeededFertilizer),
129128
style: TextStyle(
130129
fontFamily: FontFamily.pretendard,
131130
fontSize: 14,

lib/farm_page/edit_farm_set/components/fertilizer_selection_section.dart

+18-12
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,26 @@ class FertilizerSelectionSection extends StatelessWidget {
3030
FertilizerSelectionSection({
3131
super.key,
3232
SelectedFertilizerNotifier? notifier,
33-
}) : _notifier = notifier ?? SelectedFertilizerNotifier(null);
33+
OverlayPortalController? overlayController,
34+
}) : _overlayController = overlayController ?? OverlayPortalController(),
35+
_notifier = notifier ?? SelectedFertilizerNotifier(null);
3436

3537
final SelectedFertilizerNotifier _notifier;
3638

39+
final OverlayPortalController _overlayController;
40+
3741
@override
3842
Widget build(BuildContext context) {
3943
return Column(
4044
spacing: 6,
4145
crossAxisAlignment: CrossAxisAlignment.start,
4246
children: [
4347
const _FertilizerSelectionHeader(),
44-
ChangeNotifierProvider.value(
45-
value: _notifier,
48+
MultiProvider(
49+
providers: [
50+
ChangeNotifierProvider.value(value: _notifier),
51+
Provider.value(value: _overlayController),
52+
],
4653
child: const _FertilizerSelectionBody(),
4754
),
4855
],
@@ -230,9 +237,7 @@ class _GrowthFormulaButton extends StatefulWidget {
230237
}
231238

232239
class _GrowthFormulaButtonState extends State<_GrowthFormulaButton> {
233-
final _overlayController = OverlayPortalController();
234-
235-
Fertilizer _lastSelected = Items.growthFormulaStarter;
240+
Fertilizer _lastSelectedFertilizer = Items.growthFormulaStarter;
236241

237242
@override
238243
void initState() {
@@ -243,7 +248,7 @@ class _GrowthFormulaButtonState extends State<_GrowthFormulaButton> {
243248
void _initLastSelectedFertilizer() {
244249
final initialValue = widget.initialValue;
245250
if (initialValue != null) {
246-
_lastSelected = initialValue;
251+
_lastSelectedFertilizer = initialValue;
247252
}
248253
}
249254

@@ -265,9 +270,10 @@ class _GrowthFormulaButtonState extends State<_GrowthFormulaButton> {
265270
@override
266271
Widget build(BuildContext context) {
267272
final selectedFertilizer = context.watch<SelectedFertilizerNotifier>();
273+
final overlayController = context.read<OverlayPortalController>();
268274

269275
return OverlayPortal(
270-
controller: _overlayController,
276+
controller: overlayController,
271277
overlayChildBuilder: (context) {
272278
return Positioned(
273279
top: _computeOverlayOffset(context).dy,
@@ -283,9 +289,9 @@ class _GrowthFormulaButtonState extends State<_GrowthFormulaButton> {
283289
fertilizer: fertilizer,
284290
onPressed: () {
285291
selectedFertilizer.apply(fertilizer);
286-
_overlayController.hide();
292+
overlayController.hide();
287293
setState(() {
288-
_lastSelected = fertilizer;
294+
_lastSelectedFertilizer = fertilizer;
289295
});
290296
},
291297
);
@@ -297,8 +303,8 @@ class _GrowthFormulaButtonState extends State<_GrowthFormulaButton> {
297303
);
298304
},
299305
child: _FertilizerIconButton(
300-
fertilizer: _lastSelected,
301-
onPressed: _overlayController.toggle,
306+
fertilizer: _lastSelectedFertilizer,
307+
onPressed: overlayController.toggle,
302308
),
303309
);
304310
}

lib/farm_page/edit_farm_set/farm_group_edit_window.dart

+63-42
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class FarmGroupEditWindow extends StatefulWidget {
3131

3232
class _FarmGroupEditWindowState extends State<FarmGroupEditWindow> {
3333
late final FarmGroupEditController controller;
34+
final _overlayController = OverlayPortalController();
3435

3536
@override
3637
void initState() {
@@ -67,59 +68,79 @@ class _FarmGroupEditWindowState extends State<FarmGroupEditWindow> {
6768
Provider.value(value: this),
6869
ChangeNotifierProvider.value(value: controller),
6970
],
70-
child: FittedBox(
71-
child: Container(
72-
decoration: BoxDecoration(
73-
color: Colors.white,
74-
borderRadius: BorderRadius.circular(18.0),
75-
),
76-
padding: const EdgeInsets.all(18.0),
77-
child: Row(
78-
spacing: 34,
79-
crossAxisAlignment: CrossAxisAlignment.start,
80-
children: [
81-
const Row(
82-
spacing: 30,
83-
mainAxisAlignment: MainAxisAlignment.center,
84-
children: <Widget>[
85-
FertilizersInfoBox(),
86-
CropsInfoBox(),
87-
],
88-
),
89-
Column(
90-
spacing: 34,
91-
children: [
92-
const FarmGroupCanvas(),
93-
ValueListenableBuilder(
94-
valueListenable: controller.farmGroupModelNotifier,
95-
builder: (context, value, child) => const AnalysisView()),
96-
],
97-
),
98-
Column(
99-
spacing: 30.0,
71+
child: GestureDetector(
72+
onTap: () => _overlayController.hide(),
73+
child: FittedBox(
74+
child: Container(
75+
decoration: BoxDecoration(
76+
color: Colors.white,
77+
borderRadius: BorderRadius.circular(18.0),
78+
),
79+
padding: const EdgeInsets.all(18.0),
80+
child: IntrinsicHeight(
81+
child: Row(
82+
spacing: 20,
10083
crossAxisAlignment: CrossAxisAlignment.start,
10184
children: [
102-
const _TitleTextField(),
85+
Row(
86+
spacing: 30,
87+
mainAxisAlignment: MainAxisAlignment.center,
88+
children: <Widget>[
89+
const FertilizersInfoBox(),
90+
VerticalDivider(
91+
width: 1.0,
92+
color: Colors.grey.shade300,
93+
),
94+
const CropsInfoBox(),
95+
],
96+
),
97+
VerticalDivider(
98+
width: 1.0,
99+
color: Colors.grey.shade300,
100+
),
103101
Column(
104-
crossAxisAlignment: CrossAxisAlignment.start,
105-
spacing: 8,
102+
spacing: 34,
106103
children: [
107-
_buildFarmTypeSelectionBox(),
108-
_buildFarmGroupTypeSelectionBox(),
104+
const FarmGroupCanvas(),
105+
ValueListenableBuilder(
106+
valueListenable: controller.farmGroupModelNotifier,
107+
builder: (context, value, child) => const AnalysisView()),
109108
],
110109
),
111-
CropSelectionSection(notifier: controller.selectedCropNotifier),
112-
FertilizerSelectionSection(notifier: controller.selectedFertilizerNotifier),
113-
const Row(
114-
spacing: 20,
110+
VerticalDivider(
111+
width: 1.0,
112+
color: Colors.grey.shade300,
113+
),
114+
Column(
115+
spacing: 30.0,
116+
crossAxisAlignment: CrossAxisAlignment.start,
115117
children: [
116-
_CancelButton(),
117-
_OkButton(),
118+
const _TitleTextField(),
119+
Column(
120+
crossAxisAlignment: CrossAxisAlignment.start,
121+
spacing: 8,
122+
children: [
123+
_buildFarmTypeSelectionBox(),
124+
_buildFarmGroupTypeSelectionBox(),
125+
],
126+
),
127+
CropSelectionSection(notifier: controller.selectedCropNotifier),
128+
FertilizerSelectionSection(
129+
notifier: controller.selectedFertilizerNotifier,
130+
overlayController: _overlayController,
131+
),
132+
const Row(
133+
spacing: 20,
134+
children: [
135+
_CancelButton(),
136+
_OkButton(),
137+
],
138+
),
118139
],
119140
),
120141
],
121142
),
122-
],
143+
),
123144
),
124145
),
125146
),

lib/farm_page/farm_grid/farm_card/farm_card.dart

+25-17
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,39 @@ class _FarmCardFooter extends StatelessWidget {
6161
Widget build(BuildContext context) {
6262
final colorScheme = Theme.of(context).colorScheme;
6363
final model = context.watch<FarmCardModel>();
64-
final fertilizerAsset = model.linkedFertilizer?.fertilizer.assetName;
65-
final fertilizerAmount = model.linkedFertilizer?.amount;
64+
65+
final linkedFertilizer = model.linkedFertilizer;
66+
67+
if (linkedFertilizer == null) {
68+
return const SizedBox();
69+
}
70+
71+
final fertilizerName = L10ns.of(context).localized(linkedFertilizer.fertilizer.code);
6672

6773
return Container(
6874
height: 44,
6975
margin: const EdgeInsets.all(1),
7076
padding: const EdgeInsets.all(4),
7177
color: colorScheme.surfaceContainerHighest,
7278
child: Center(
73-
// TODO: Wrap below Row with Tooltip.
74-
child: Row(
75-
spacing: 4,
76-
mainAxisSize: MainAxisSize.min,
77-
children: [
78-
Image(
79-
image: AssetImage('assets/images/items/$fertilizerAsset.png'),
80-
),
81-
Text(
82-
'x $fertilizerAmount',
83-
style: const TextStyle(
84-
fontFamily: FontFamily.pretendard,
85-
fontSize: 14,
79+
child: Tooltip(
80+
message: L10ns.of(context).farmCard.footerFertilizerTooltip(fertilizerName, linkedFertilizer.amount),
81+
child: Row(
82+
spacing: 4,
83+
mainAxisSize: MainAxisSize.min,
84+
children: [
85+
Image(
86+
image: AssetImage('assets/images/items/${linkedFertilizer.fertilizer.assetName}.png'),
8687
),
87-
),
88-
],
88+
Text(
89+
'x ${linkedFertilizer.amount}',
90+
style: const TextStyle(
91+
fontFamily: FontFamily.pretendard,
92+
fontSize: 14,
93+
),
94+
),
95+
],
96+
),
8997
),
9098
),
9199
);

lib/farm_page/farm_page.dart

-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ class _TopBar extends StatelessWidget {
9595
children: [
9696
_SeasonSelectionBox(),
9797
_NewButton(),
98-
SizedBox(width: 50),
9998
_ShowAndHideCheckbox(),
10099
],
101100
),

lib/farm_page/side_info_box/crops_info_box.dart

-34
Original file line numberDiff line numberDiff line change
@@ -148,40 +148,6 @@ class CropsInfoBox extends StatelessWidget {
148148
}
149149
}
150150

151-
class CropsInfoBoxTag extends StatelessWidget {
152-
const CropsInfoBoxTag({
153-
super.key,
154-
this.onPressed,
155-
this.size = const Size(50, 50),
156-
required this.color,
157-
});
158-
159-
final Color color;
160-
final Size size;
161-
final void Function()? onPressed;
162-
163-
@override
164-
Widget build(BuildContext context) {
165-
return Container(
166-
width: size.width,
167-
height: size.height,
168-
decoration: BoxDecoration(
169-
color: color,
170-
borderRadius: const BorderRadius.only(
171-
topLeft: Radius.circular(20),
172-
bottomLeft: Radius.circular(20),
173-
),
174-
boxShadow: kElevationToShadow[2],
175-
),
176-
child: IconButton(
177-
padding: const EdgeInsets.only(top: 4, bottom: 2),
178-
onPressed: onPressed,
179-
icon: Image.asset("assets/images/nutrients_manure_icon.png"),
180-
),
181-
);
182-
}
183-
}
184-
185151
class SeasonIndicator extends StatelessWidget {
186152
const SeasonIndicator({
187153
super.key,

0 commit comments

Comments
 (0)