showQualityDialog method
Implementation
void showQualityDialog(BuildContext context) {
if (qualities.isEmpty) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('No qualities available'),
),
);
return;
}
if (context.orientation == Orientation.landscape) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
title: const Text(
'Quality',
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
content: Obx(() {
return SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
// InkWell(
// onTap: () {
// Navigator.pop(context);
// if (configuration.autoQuality) {
// configuration = configuration.copyWith(
// autoQuality: false,
// );
// } else {
// configuration = configuration.copyWith(
// autoQuality: true,
// );
// }
// startAutoQuality();
// },
// child: Padding(
// padding: const EdgeInsets.symmetric(
// vertical: 5,
// horizontal: 10,
// ),
// child: Row(
// children: [
// configuration.autoQuality
// ? const Icon(
// Icons.check_box_rounded,
// color: Colors.blue,
// )
// : const Icon(
// Icons.check_box_outline_blank,
// color: Colors.grey,
// ),
// 10.widthBox,
// const Expanded(child: Text("Auto")),
// ],
// ),
// ),
// ),
...qualities.value.map(
(quality) => InkWell(
onTap: () {
Navigator.pop(context);
selectedQuality = quality;
_qualityStream.add(quality);
setQuality(quality);
},
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 5,
horizontal: 10,
),
child: Row(
children: [
selectedQuality == quality
? const Icon(
Icons.check_box_rounded,
color: Colors.blue,
)
: const Icon(
Icons.check_box_outline_blank,
color: Colors.grey,
),
10.widthBox,
Text(quality),
],
),
),
),
)
],
),
);
}),
);
},
);
} else {
showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(
top: Radius.circular(10),
),
),
isScrollControlled: true,
builder: (context) {
return Padding(
padding: const EdgeInsets.all(10),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
const Text(
'Quality',
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const Divider(),
Obx(() {
return Column(
children: [
// InkWell(
// onTap: () {
// Navigator.pop(context);
// if (configuration.autoQuality) {
// configuration = configuration.copyWith(
// autoQuality: false,
// );
// } else {
// configuration = configuration.copyWith(
// autoQuality: true,
// );
// }
// startAutoQuality();
// },
// child: Padding(
// padding: const EdgeInsets.symmetric(
// vertical: 2,
// horizontal: 5,
// ),
// child: Row(
// children: [
// configuration.autoQuality
// ? const Icon(
// Icons.check_box_rounded,
// color: Colors.blue,
// )
// : const Icon(
// Icons.check_box_outline_blank,
// color: Colors.grey,
// ),
// 10.widthBox,
// const Expanded(child: Text("Auto")),
// ],
// ),
// ),
// ),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: qualities.value.length,
itemBuilder: (context, index) {
final quality = qualities[index];
return InkWell(
onTap: () {
Navigator.pop(context);
selectedQuality = quality;
_qualityStream.add(quality);
setQuality(quality);
},
child: Padding(
padding: const EdgeInsets.symmetric(
vertical: 2,
horizontal: 5,
),
child: Row(
children: [
selectedQuality == quality
? const Icon(
Icons.check_box_rounded,
color: Colors.blue,
)
: const Icon(
Icons.check_box_outline_blank,
color: Colors.grey,
),
10.widthBox,
Expanded(child: Text(quality)),
],
),
),
);
},
),
],
);
}),
],
),
);
},
);
}
}