Skip to content

Commit

Permalink
move placeholder to private widget
Browse files Browse the repository at this point in the history
  • Loading branch information
mertalev committed Nov 12, 2024
1 parent 57505b0 commit d39c823
Showing 1 changed file with 29 additions and 20 deletions.
49 changes: 29 additions & 20 deletions mobile/lib/widgets/asset_viewer/video_position.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,6 @@ import 'package:immich_mobile/widgets/asset_viewer/formatted_duration.dart';
import 'package:immich_mobile/widgets/asset_viewer/video_mute_button.dart';

class VideoPosition extends HookConsumerWidget {
static void _onChangedDummy(_) {}
static const placeholder = Row(
children: [
FormattedDuration(Duration.zero),
Expanded(
child: Slider(
value: 0.0,
min: 0,
max: 100,
thumbColor: Colors.white,
activeColor: Colors.white,
inactiveColor: whiteOpacity75,
onChanged: _onChangedDummy,
),
),
FormattedDuration(Duration.zero),
VideoMuteButton(),
],
);
const VideoPosition({super.key});

@override
Expand All @@ -38,7 +19,7 @@ class VideoPosition extends HookConsumerWidget {
);
final wasPlaying = useRef<bool>(true);
return duration == Duration.zero
? placeholder
? const _VideoPositionPlaceholder()
: Row(
children: [
FormattedDuration(position),
Expand Down Expand Up @@ -75,3 +56,31 @@ class VideoPosition extends HookConsumerWidget {
);
}
}

class _VideoPositionPlaceholder extends StatelessWidget {
const _VideoPositionPlaceholder();

static void _onChangedDummy(_) {}

@override
Widget build(BuildContext context) {
return const Row(
children: [
FormattedDuration(Duration.zero),
Expanded(
child: Slider(
value: 0.0,
min: 0,
max: 100,
thumbColor: Colors.white,
activeColor: Colors.white,
inactiveColor: whiteOpacity75,
onChanged: _onChangedDummy,
),
),
FormattedDuration(Duration.zero),
VideoMuteButton(),
],
);
}
}

0 comments on commit d39c823

Please sign in to comment.