Skip to content

Commit 3f18af8

Browse files
committed
Update widget usage
1 parent 09409ee commit 3f18af8

File tree

2 files changed

+16
-20
lines changed

2 files changed

+16
-20
lines changed

lib/feature/sound/modal/sound_file_modal.dart

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
import 'package:flutter/material.dart';
22
import 'package:stelaris/feature/base/button/cancel_button.dart';
3+
import 'package:stelaris/feature/sound/modal/section/base_section.dart';
34
import 'package:stelaris/feature/sound/modal/section/integer_fields_section.dart';
45
import 'package:stelaris/feature/sound/modal/section/sound_switch_section.dart';
56
import 'package:stelaris/feature/sound/modal/section/volume_section.dart';
67

8+
import 'section/string_field_section.dart';
9+
710
class SoundFileModal extends StatefulWidget {
811
final void Function({
12+
required String name,
913
required double volume,
1014
required double pitch,
1115
required int weight,
@@ -25,6 +29,7 @@ class SoundFileModal extends StatefulWidget {
2529
}
2630

2731
class _SoundFileModalState extends State<SoundFileModal> {
32+
String _name = '';
2833
double _volume = 1;
2934
double _pitch = 1;
3035
int _weight = 1;
@@ -56,27 +61,21 @@ class _SoundFileModalState extends State<SoundFileModal> {
5661
style: Theme.of(context).textTheme.titleLarge,
5762
),
5863
const SizedBox(height: 24),
59-
// Section 1: Volume & Pitch
64+
const StringInputSection(),
65+
const SizedBox(height: 16),
6066
VolumeSection(
6167
initialPitch: _pitch,
6268
initialVolume: _volume,
6369
onPitchFinalized: (v) => setState(() => _pitch = v),
6470
onVolumeFinalized: (v) => setState(() => _volume = v),
6571
),
6672
const SizedBox(height: 16),
67-
Container(
68-
decoration: BoxDecoration(
69-
color: surfaceVariant,
70-
borderRadius: BorderRadius.circular(16),
71-
),
72-
padding: const EdgeInsets.all(16),
73-
child: IntegerFieldsSection(
74-
initialWeight: _weight,
75-
initialAttenuationDistance: _attenuationDistance,
76-
onWeightChanged: (v) => setState(() => _weight = v),
77-
onAttenuationDistanceChanged: (v) =>
78-
setState(() => _attenuationDistance = v),
79-
),
73+
IntegerFieldsSection(
74+
initialWeight: _weight,
75+
initialAttenuationDistance: _attenuationDistance,
76+
onWeightChanged: (v) => setState(() => _weight = v),
77+
onAttenuationDistanceChanged: (v) =>
78+
setState(() => _attenuationDistance = v),
8079
),
8180
const SizedBox(height: 16),
8281
// Section 3: Switches
@@ -89,12 +88,7 @@ class _SoundFileModalState extends State<SoundFileModal> {
8988
),
9089
const SizedBox(height: 16),
9190
// Section 4: Type dropdown
92-
Container(
93-
decoration: BoxDecoration(
94-
color: surfaceVariant,
95-
borderRadius: BorderRadius.circular(16),
96-
),
97-
padding: const EdgeInsets.all(16),
91+
BaseSection(
9892
child: DropdownButtonFormField<String>(
9993
initialValue: _type,
10094
decoration: const InputDecoration(
@@ -118,6 +112,7 @@ class _SoundFileModalState extends State<SoundFileModal> {
118112
onPressed: () {
119113
if (_formKey.currentState?.validate() ?? false) {
120114
widget.onSave?.call(
115+
name: _name,
121116
volume: _volume,
122117
pitch: _pitch,
123118
weight: _weight,

lib/feature/sound/sound_file_entries.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ class _SoundFileEntriesState extends State<SoundFileEntryPage> {
9090
create: true,
9191
onSave:
9292
({
93+
required name,
9394
required volume,
9495
required pitch,
9596
required weight,

0 commit comments

Comments
 (0)