40 lines
1.3 KiB
Dart
40 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:notube/constants.dart';
|
|
import 'package:notube/dlForm/cubit/dl_form_cubit.dart';
|
|
|
|
class DropdownFormat extends StatelessWidget {
|
|
const DropdownFormat({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final dlFormState = context.select((DlFormCubit cubit) => cubit.state);
|
|
|
|
return Container(
|
|
padding: EdgeInsets.symmetric(
|
|
horizontal: 15,
|
|
),
|
|
decoration: BoxDecoration(color: colorMainBlue),
|
|
|
|
// dropdown below..
|
|
child: DropdownButton<String>(
|
|
value: dlFormState.format.format,
|
|
elevation: 16,
|
|
style: const TextStyle(color: colorMainWhite),
|
|
dropdownColor: colorMainBlue,
|
|
onChanged: (String? value) {
|
|
var format =
|
|
Format.values.firstWhere((element) => element.format == value);
|
|
context.read<DlFormCubit>().setFormat(format!);
|
|
},
|
|
underline: Container(),
|
|
items: Format.values.map<DropdownMenuItem<String>>((Format format) {
|
|
return DropdownMenuItem<String>(
|
|
value: format.format,
|
|
child: Text(format.format),
|
|
);
|
|
}).toList(),
|
|
));
|
|
}
|
|
}
|