mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-05-08 05:20:46 +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),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
_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,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
children: [_seekToWidget(), _buildSettingsButtons(context)],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
@ -1048,44 +995,63 @@ class _AnimeStreamPageState extends riv.ConsumerState<AnimeStreamPage>
|
|||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
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),
|
||||
],
|
||||
),
|
||||
_buildSettingsButtons(context),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/// 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) {
|
||||
return ValueListenableBuilder<bool>(
|
||||
valueListenable: _enterFullScreen,
|
||||
|
|
|
|||
Loading…
Reference in a new issue