PSDK-1153 - Правка экрана настроек и вывода субтитров
This commit is contained in:
committed by
Jura Shikin
parent
92d1a5801f
commit
e52362282f
@@ -84,7 +84,7 @@ class PlayerViewBloc extends Bloc<PlayerViewEvent, PlayerViewState> {
|
||||
_subtitlesListener = () {
|
||||
final subtitles = controller.value.subtitles;
|
||||
if (subtitles != null) {
|
||||
if (subtitles.isNotEmpty) { add(SubsReceivedEvent(subtitles)); }
|
||||
if (subtitles.length > 1) { add(SubsReceivedEvent(subtitles)); }
|
||||
_listenToChanges(_subtitlesListener, false);
|
||||
_subtitlesListener = null;
|
||||
}
|
||||
|
||||
+23
-19
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../common/models/option_data.dart';
|
||||
|
||||
class PlayerSettingsView extends StatelessWidget {
|
||||
@@ -10,21 +9,28 @@ class PlayerSettingsView extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
final item = options[index];
|
||||
return Column(children: <Widget>[
|
||||
_buildNavTile(item, context),
|
||||
_buildSeparator()
|
||||
]);
|
||||
},
|
||||
itemCount: options.length,
|
||||
return Container(
|
||||
decoration: const BoxDecoration(
|
||||
color: CupertinoColors.white,
|
||||
borderRadius: BorderRadius.vertical(top: Radius.circular(5))
|
||||
),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
padding: const EdgeInsets.only(top: 5, bottom: 30),
|
||||
itemBuilder: (context, index) {
|
||||
final item = options[index];
|
||||
return Column(children: <Widget>[
|
||||
_buildNavTile(item, context),
|
||||
_buildSeparator()
|
||||
]);
|
||||
},
|
||||
itemCount: options.length,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNavTile(OptionDataContainer option, BuildContext context) {
|
||||
return ListTile(
|
||||
return CupertinoListTile(
|
||||
title: Row(
|
||||
children: [
|
||||
Text(option.title, style: TextStyle(color: CupertinoColors.black.withOpacity(0.45), fontWeight: FontWeight.w400)),
|
||||
@@ -81,8 +87,7 @@ class PlayerSettingsView extends StatelessWidget {
|
||||
}
|
||||
|
||||
Widget _buildBackButton(OptionDataContainer option, BuildContext context) {
|
||||
return Material(
|
||||
child: ListTile(
|
||||
return CupertinoListTile(
|
||||
title: Row(
|
||||
children: [
|
||||
const Icon(CupertinoIcons.chevron_back, color: CupertinoColors.systemGrey),
|
||||
@@ -93,7 +98,7 @@ class PlayerSettingsView extends StatelessWidget {
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
));
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildSeparator() {
|
||||
@@ -108,11 +113,10 @@ class PlayerSettingsView extends StatelessWidget {
|
||||
final currentOption = option.options[index];
|
||||
final isSelected = option.selectedIndex == index;
|
||||
|
||||
return Material(
|
||||
child: ListTile(
|
||||
return CupertinoListTile(
|
||||
title: Row(
|
||||
children: [
|
||||
if (isSelected) const Icon(CupertinoIcons.checkmark),
|
||||
if (isSelected) const Icon(CupertinoIcons.checkmark, color: CupertinoColors.black),
|
||||
SizedBox(width: (isSelected) ? 6 : 30),
|
||||
Text(currentOption.title, style: const TextStyle(color: CupertinoColors.black, fontWeight: FontWeight.w400)),
|
||||
const Spacer()
|
||||
@@ -125,6 +129,6 @@ class PlayerSettingsView extends StatelessWidget {
|
||||
Navigator.of(context)..pop()..pop();
|
||||
}
|
||||
},
|
||||
));
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:nut_player_example/src/common/models/option_data.dart';
|
||||
@@ -62,10 +61,7 @@ class _PlayerViewState extends State<PlayerView> {
|
||||
});
|
||||
}
|
||||
case 'pluginSkinSettingsAction':
|
||||
showModalBottomSheet(
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5.0),
|
||||
),
|
||||
showCupertinoModalPopup(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
final speedSettings = PlayerViewController.playbackSettings.firstWhere((element) => element.key == const Key('PlaybackSpeedSettingID'));
|
||||
@@ -260,7 +256,7 @@ class _PlayerViewState extends State<PlayerView> {
|
||||
}
|
||||
|
||||
final subtitles = _createSubs(bloc);
|
||||
if (subtitles != null && subtitles.options.length > 1) {
|
||||
if (subtitles != null) {
|
||||
final subtitleWidget = _buildOptionsView(subtitles, bloc);
|
||||
widgets.insert(2, subtitleWidget);
|
||||
}
|
||||
@@ -366,7 +362,7 @@ class _PlayerViewState extends State<PlayerView> {
|
||||
child: Container(
|
||||
width: size.width,
|
||||
height: size.height,
|
||||
color: Colors.black,
|
||||
color: CupertinoColors.black,
|
||||
child: videoPlayer,
|
||||
)
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user