mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-05-17 22:31:56 +00:00
Reduce Code duplication
This commit is contained in:
parent
b2695aae49
commit
3bb8c1acdf
1 changed files with 52 additions and 86 deletions
|
|
@ -848,60 +848,7 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage>
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 8),
|
padding: const EdgeInsets.symmetric(horizontal: 8),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [_seekToWidget(), _buildSettingsButtons(context)],
|
||||||
_seekToWidget(),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
IconButton(
|
|
||||||
padding: const EdgeInsets.all(5),
|
|
||||||
onPressed: () => _videoSettingDraggableMenu(context),
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.video_settings,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
child: ValueListenableBuilder<double>(
|
|
||||||
valueListenable: _playbackSpeed,
|
|
||||||
builder: (context, value, child) {
|
|
||||||
return Text(
|
|
||||||
"${value}x",
|
|
||||||
style: const TextStyle(color: Colors.white),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
_togglePlaybackSpeed();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.fit_screen_outlined,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
_changeFitLabel(ref);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
ValueListenableBuilder<bool>(
|
|
||||||
valueListenable: _enterFullScreen,
|
|
||||||
builder: (context, snapshot, _) {
|
|
||||||
return IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
_setLandscapeMode(!snapshot);
|
|
||||||
_enterFullScreen.value = !snapshot;
|
|
||||||
},
|
|
||||||
icon: Icon(
|
|
||||||
snapshot ? Icons.fullscreen_exit : Icons.fullscreen,
|
|
||||||
),
|
|
||||||
iconSize: 25,
|
|
||||||
color: Colors.white,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|
@ -1048,44 +995,63 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage>
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Row(
|
_buildSettingsButtons(context),
|
||||||
children: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: () => _videoSettingDraggableMenu(context),
|
|
||||||
icon: const Icon(Icons.video_settings, color: Colors.white),
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
child: ValueListenableBuilder<double>(
|
|
||||||
valueListenable: _playbackSpeed,
|
|
||||||
builder: (context, value, child) {
|
|
||||||
return Text(
|
|
||||||
"${value}x",
|
|
||||||
style: const TextStyle(color: Colors.white),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
_togglePlaybackSpeed();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.fit_screen_outlined,
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
onPressed: () async {
|
|
||||||
_changeFitLabel(ref);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
CustomMaterialDesktopFullscreenButton(controller: _controller),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// helper method for _mobileBottomButtonBar() and _desktopBottomButtonBar()
|
||||||
|
Widget _buildSettingsButtons(BuildContext context) {
|
||||||
|
return Row(
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
padding: _isDesktop ? EdgeInsets.zero : const EdgeInsets.all(5),
|
||||||
|
onPressed: () => _videoSettingDraggableMenu(context),
|
||||||
|
icon: const Icon(Icons.video_settings, color: Colors.white),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
child: ValueListenableBuilder<double>(
|
||||||
|
valueListenable: _playbackSpeed,
|
||||||
|
builder: (context, value, child) {
|
||||||
|
return Text(
|
||||||
|
"${value}x",
|
||||||
|
style: const TextStyle(color: Colors.white),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
onPressed: () {
|
||||||
|
_togglePlaybackSpeed();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.fit_screen_outlined, color: Colors.white),
|
||||||
|
onPressed: () async {
|
||||||
|
_changeFitLabel(ref);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (_isDesktop)
|
||||||
|
CustomMaterialDesktopFullscreenButton(controller: _controller)
|
||||||
|
else
|
||||||
|
ValueListenableBuilder<bool>(
|
||||||
|
valueListenable: _enterFullScreen,
|
||||||
|
builder: (context, snapshot, _) {
|
||||||
|
return IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
_setLandscapeMode(!snapshot);
|
||||||
|
_enterFullScreen.value = !snapshot;
|
||||||
|
},
|
||||||
|
icon: Icon(snapshot ? Icons.fullscreen_exit : Icons.fullscreen),
|
||||||
|
iconSize: 25,
|
||||||
|
color: Colors.white,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _topButtonBar(BuildContext context) {
|
Widget _topButtonBar(BuildContext context) {
|
||||||
return ValueListenableBuilder<bool>(
|
return ValueListenableBuilder<bool>(
|
||||||
valueListenable: _enterFullScreen,
|
valueListenable: _enterFullScreen,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue