11import 'package:flutter/material.dart' ;
22import 'package:stelaris/feature/base/button/cancel_button.dart' ;
3+ import 'package:stelaris/feature/sound/modal/section/base_section.dart' ;
34import 'package:stelaris/feature/sound/modal/section/integer_fields_section.dart' ;
45import 'package:stelaris/feature/sound/modal/section/sound_switch_section.dart' ;
56import 'package:stelaris/feature/sound/modal/section/volume_section.dart' ;
67
8+ import 'section/string_field_section.dart' ;
9+
710class 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
2731class _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,
0 commit comments