Atualização geral de optimazação e desing
This commit is contained in:
212
lib/screens/settings_screen.dart
Normal file
212
lib/screens/settings_screen.dart
Normal file
@@ -0,0 +1,212 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../main.dart' show supabase;
|
||||
import '../widgets/app_dialogs.dart';
|
||||
import 'terms_screen.dart';
|
||||
|
||||
const Color _teal = Color(0xFF2F9E94);
|
||||
const Color _accentPink = Color(0xFFFF55A7);
|
||||
|
||||
/// Conteúdo da aba de Configurações, para ser embutido na bottom navigation
|
||||
/// do LoggedHomeScreen (sem Scaffold/AppBar próprios).
|
||||
class SettingsBody extends StatefulWidget {
|
||||
const SettingsBody({super.key});
|
||||
|
||||
@override
|
||||
State<SettingsBody> createState() => _SettingsBodyState();
|
||||
}
|
||||
|
||||
class _SettingsBodyState extends State<SettingsBody> {
|
||||
bool _deletingAccount = false;
|
||||
|
||||
Future<void> _signOut() async {
|
||||
await supabase.auth.signOut();
|
||||
if (!mounted) return;
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
}
|
||||
|
||||
Future<void> _confirmDeleteAccountData() async {
|
||||
final messenger = ScaffoldMessenger.of(context);
|
||||
final confirmed = await showConfirmDialog(
|
||||
context,
|
||||
title: 'Apagar dados da conta',
|
||||
message:
|
||||
'Isso remove permanentemente seu perfil, crianças cadastradas e '
|
||||
'fotos. Essa ação não pode ser desfeita. Deseja continuar?',
|
||||
confirmLabel: 'Apagar',
|
||||
confirmColor: _accentPink,
|
||||
);
|
||||
|
||||
if (confirmed != true) return;
|
||||
|
||||
final uid = supabase.auth.currentUser?.id;
|
||||
if (uid == null) return;
|
||||
|
||||
setState(() => _deletingAccount = true);
|
||||
try {
|
||||
await supabase.from('children').delete().eq('owner_id', uid);
|
||||
await supabase.from('profiles').delete().eq('id', uid);
|
||||
await supabase.auth.signOut();
|
||||
if (!mounted) return;
|
||||
Navigator.of(context).popUntil((route) => route.isFirst);
|
||||
} catch (e) {
|
||||
messenger.showSnackBar(SnackBar(content: Text('Erro ao apagar: $e')));
|
||||
} finally {
|
||||
if (mounted) setState(() => _deletingAccount = false);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final user = supabase.auth.currentUser;
|
||||
final name = (user?.userMetadata?['name'] ?? '').toString().trim();
|
||||
final email = (user?.email ?? '').trim();
|
||||
|
||||
return ListView(
|
||||
padding: const EdgeInsets.all(16),
|
||||
children: [
|
||||
_SectionLabel('Conta'),
|
||||
_SettingsCard(
|
||||
children: [
|
||||
_InfoTile(
|
||||
icon: Icons.person_outline_rounded,
|
||||
title: name.isEmpty ? 'Sem nome' : name,
|
||||
subtitle: email,
|
||||
),
|
||||
const Divider(height: 1),
|
||||
_ActionTile(
|
||||
icon: Icons.logout_rounded,
|
||||
title: 'Sair',
|
||||
onTap: _signOut,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_SectionLabel('Sobre'),
|
||||
_SettingsCard(
|
||||
children: [
|
||||
_ActionTile(
|
||||
icon: Icons.description_outlined,
|
||||
title: 'Termos de Serviço',
|
||||
onTap: () => Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(builder: (_) => const TermsScreen()),
|
||||
),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
const _InfoTile(
|
||||
icon: Icons.info_outline_rounded,
|
||||
title: 'Versão do app',
|
||||
subtitle: '1.0.0',
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_SectionLabel('Zona de risco'),
|
||||
_SettingsCard(
|
||||
children: [
|
||||
_ActionTile(
|
||||
icon: Icons.delete_forever_rounded,
|
||||
title: 'Apagar dados da conta',
|
||||
titleColor: _accentPink,
|
||||
loading: _deletingAccount,
|
||||
onTap: _deletingAccount ? null : _confirmDeleteAccountData,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SectionLabel extends StatelessWidget {
|
||||
const _SectionLabel(this.text);
|
||||
|
||||
final String text;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 4, bottom: 8),
|
||||
child: Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
color: _teal,
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SettingsCard extends StatelessWidget {
|
||||
const _SettingsCard({required this.children});
|
||||
|
||||
final List<Widget> children;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(18),
|
||||
elevation: 6,
|
||||
shadowColor: Colors.black.withValues(alpha: 0.12),
|
||||
child: Column(children: children),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _InfoTile extends StatelessWidget {
|
||||
const _InfoTile({required this.icon, required this.title, this.subtitle});
|
||||
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final String? subtitle;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: Icon(icon, color: _teal),
|
||||
title: Text(title, style: const TextStyle(fontWeight: FontWeight.w800)),
|
||||
subtitle: (subtitle == null || subtitle!.isEmpty)
|
||||
? null
|
||||
: Text(subtitle!),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ActionTile extends StatelessWidget {
|
||||
const _ActionTile({
|
||||
required this.icon,
|
||||
required this.title,
|
||||
required this.onTap,
|
||||
this.titleColor,
|
||||
this.loading = false,
|
||||
});
|
||||
|
||||
final IconData icon;
|
||||
final String title;
|
||||
final VoidCallback? onTap;
|
||||
final Color? titleColor;
|
||||
final bool loading;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListTile(
|
||||
leading: Icon(icon, color: titleColor ?? _teal),
|
||||
title: Text(
|
||||
title,
|
||||
style: TextStyle(fontWeight: FontWeight.w800, color: titleColor),
|
||||
),
|
||||
trailing: loading
|
||||
? const SizedBox(
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.chevron_right_rounded),
|
||||
onTap: onTap,
|
||||
);
|
||||
}
|
||||
}
|
||||
72
lib/screens/terms_screen.dart
Normal file
72
lib/screens/terms_screen.dart
Normal file
@@ -0,0 +1,72 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TermsScreen extends StatelessWidget {
|
||||
const TermsScreen({super.key});
|
||||
|
||||
static const Color _teal = Color(0xFF2F9E94);
|
||||
static const Color _accentPink = Color(0xFFFF55A7);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: _teal,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
title: const Text(
|
||||
'Termos de Serviço',
|
||||
style: TextStyle(fontWeight: FontWeight.w900),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [Color(0xFFFFE6F1), Color(0xFFFFC9DF)],
|
||||
),
|
||||
),
|
||||
child: SafeArea(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
const Text(
|
||||
'Termos de Serviço',
|
||||
style: TextStyle(
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w900,
|
||||
color: _accentPink,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Expanded(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(18),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white.withValues(alpha: 0.85),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: const SingleChildScrollView(
|
||||
child: Text(
|
||||
'Conteúdo dos Termos de Serviço em breve.\n\n'
|
||||
'Este espaço será preenchido com os termos de uso e '
|
||||
'condições do Check-Teeth Kids.',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
height: 1.5,
|
||||
color: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -4,19 +4,24 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:lottie/lottie.dart';
|
||||
import 'package:video_player/video_player.dart';
|
||||
import 'package:youtube_player_flutter/youtube_player_flutter.dart';
|
||||
|
||||
// Video data structure - easily editable for future updates
|
||||
// Video data structure - easily editable for future updates.
|
||||
// Episódios 1-7 tocam via YouTube (não listado); preencha youtubeId ao subir
|
||||
// cada vídeo. Episódios 8-13 continuam embutidos no app (assets/videos).
|
||||
class VideoData {
|
||||
final int id;
|
||||
final String title;
|
||||
final String description;
|
||||
final String videoPath;
|
||||
final String? videoPath;
|
||||
final String? youtubeId;
|
||||
|
||||
VideoData({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.videoPath,
|
||||
this.videoPath,
|
||||
this.youtubeId,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -26,43 +31,43 @@ final List<VideoData> videoList = [
|
||||
id: 1,
|
||||
title: 'Episódio 1',
|
||||
description: 'Aprenda sobre saúde bucal neste episódio',
|
||||
videoPath: 'assets/videos/episodio_01.mp4',
|
||||
youtubeId: '', // TODO: colar o ID do vídeo do YouTube (não listado)
|
||||
),
|
||||
VideoData(
|
||||
id: 2,
|
||||
title: 'Episódio 2',
|
||||
description: 'Aprenda sobre saúde bucal neste episódio',
|
||||
videoPath: 'assets/videos/episodio_02.mp4',
|
||||
youtubeId: '', // TODO: colar o ID do vídeo do YouTube (não listado)
|
||||
),
|
||||
VideoData(
|
||||
id: 3,
|
||||
title: 'Episódio 3',
|
||||
description: 'Aprenda sobre saúde bucal neste episódio',
|
||||
videoPath: 'assets/videos/episodio_03.mp4',
|
||||
youtubeId: '', // TODO: colar o ID do vídeo do YouTube (não listado)
|
||||
),
|
||||
VideoData(
|
||||
id: 4,
|
||||
title: 'Episódio 4',
|
||||
description: 'Aprenda sobre saúde bucal neste episódio',
|
||||
videoPath: 'assets/videos/episodio_04.mp4',
|
||||
youtubeId: '', // TODO: colar o ID do vídeo do YouTube (não listado)
|
||||
),
|
||||
VideoData(
|
||||
id: 5,
|
||||
title: 'Episódio 5',
|
||||
description: 'Aprenda sobre saúde bucal neste episódio',
|
||||
videoPath: 'assets/videos/episodio_05.mp4',
|
||||
youtubeId: '', // TODO: colar o ID do vídeo do YouTube (não listado)
|
||||
),
|
||||
VideoData(
|
||||
id: 6,
|
||||
title: 'Episódio 6',
|
||||
description: 'Aprenda sobre saúde bucal neste episódio',
|
||||
videoPath: 'assets/videos/episodio_06.mp4',
|
||||
youtubeId: '', // TODO: colar o ID do vídeo do YouTube (não listado)
|
||||
),
|
||||
VideoData(
|
||||
id: 7,
|
||||
title: 'Episódio 7',
|
||||
description: 'Aprenda sobre saúde bucal neste episódio',
|
||||
videoPath: 'assets/videos/episodio_07.mp4',
|
||||
youtubeId: '', // TODO: colar o ID do vídeo do YouTube (não listado)
|
||||
),
|
||||
VideoData(
|
||||
id: 8,
|
||||
@@ -105,6 +110,25 @@ final List<VideoData> videoList = [
|
||||
// Cache for video controllers to avoid re-initializing
|
||||
final Map<String, VideoPlayerController> _videoControllerCache = {};
|
||||
|
||||
Future<void> showVideoPlayerDialog(BuildContext context, VideoData video) {
|
||||
if (video.youtubeId != null) {
|
||||
if (video.youtubeId!.isEmpty) {
|
||||
ScaffoldMessenger.of(
|
||||
context,
|
||||
).showSnackBar(const SnackBar(content: Text('Vídeo ainda não disponível')));
|
||||
return Future.value();
|
||||
}
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => _YoutubePlayerDialog(video: video),
|
||||
);
|
||||
}
|
||||
return showDialog<void>(
|
||||
context: context,
|
||||
builder: (context) => _VideoPlayerDialog(video: video),
|
||||
);
|
||||
}
|
||||
|
||||
class VideoScreen extends StatefulWidget {
|
||||
const VideoScreen({super.key});
|
||||
|
||||
@@ -268,29 +292,41 @@ class _VideoScreenState extends State<VideoScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
class _VideoButton extends StatefulWidget {
|
||||
const _VideoButton({required this.video});
|
||||
/// Preview de um vídeo (frame local ou thumbnail do YouTube), reutilizável
|
||||
/// em qualquer card que precise mostrar "a cara" de um episódio.
|
||||
class VideoThumbnail extends StatefulWidget {
|
||||
const VideoThumbnail({
|
||||
super.key,
|
||||
required this.video,
|
||||
this.borderRadius = 12,
|
||||
this.iconSize = 48,
|
||||
});
|
||||
|
||||
final VideoData video;
|
||||
final double borderRadius;
|
||||
final double iconSize;
|
||||
|
||||
@override
|
||||
State<_VideoButton> createState() => _VideoButtonState();
|
||||
State<VideoThumbnail> createState() => _VideoThumbnailState();
|
||||
}
|
||||
|
||||
class _VideoButtonState extends State<_VideoButton> {
|
||||
class _VideoThumbnailState extends State<VideoThumbnail> {
|
||||
VideoPlayerController? _controller;
|
||||
bool _isInitialized = false;
|
||||
|
||||
bool get _isYoutube => widget.video.youtubeId != null;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initializeVideo();
|
||||
if (!_isYoutube) _initializeVideo();
|
||||
}
|
||||
|
||||
Future<void> _initializeVideo() async {
|
||||
final path = widget.video.videoPath!;
|
||||
// Check if controller exists in cache
|
||||
if (_videoControllerCache.containsKey(widget.video.videoPath)) {
|
||||
_controller = _videoControllerCache[widget.video.videoPath];
|
||||
if (_videoControllerCache.containsKey(path)) {
|
||||
_controller = _videoControllerCache[path];
|
||||
await _controller!.seekTo(const Duration(seconds: 2));
|
||||
await _controller!.pause();
|
||||
if (mounted) {
|
||||
@@ -302,12 +338,12 @@ class _VideoButtonState extends State<_VideoButton> {
|
||||
}
|
||||
|
||||
// Create new controller and cache it
|
||||
_controller = VideoPlayerController.asset(widget.video.videoPath);
|
||||
_controller = VideoPlayerController.asset(path);
|
||||
try {
|
||||
await _controller!.initialize();
|
||||
await _controller!.seekTo(const Duration(seconds: 2));
|
||||
await _controller!.pause();
|
||||
_videoControllerCache[widget.video.videoPath] = _controller!;
|
||||
_videoControllerCache[path] = _controller!;
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isInitialized = true;
|
||||
@@ -332,6 +368,73 @@ class _VideoButtonState extends State<_VideoButton> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (_isYoutube) {
|
||||
final youtubeId = widget.video.youtubeId!;
|
||||
if (youtubeId.isEmpty) {
|
||||
return Center(
|
||||
child: Icon(
|
||||
Icons.hourglass_top_rounded,
|
||||
size: widget.iconSize * 0.85,
|
||||
color: Colors.black26,
|
||||
),
|
||||
);
|
||||
}
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(widget.borderRadius),
|
||||
child: Image.network(
|
||||
'https://img.youtube.com/vi/$youtubeId/hqdefault.jpg',
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
errorBuilder: (context, error, stackTrace) => Center(
|
||||
child: Icon(
|
||||
Icons.play_circle_fill_rounded,
|
||||
size: widget.iconSize,
|
||||
color: VideoScreen._accentPink,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
return _isInitialized && _controller != null
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.circular(widget.borderRadius),
|
||||
child: FittedBox(
|
||||
fit: BoxFit.cover,
|
||||
child: SizedBox(
|
||||
width: _controller!.value.size.width,
|
||||
height: _controller!.value.size.height,
|
||||
child: VideoPlayer(_controller!),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Center(
|
||||
child: Icon(
|
||||
Icons.play_circle_fill_rounded,
|
||||
size: widget.iconSize,
|
||||
color: VideoScreen._accentPink,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _VideoButton extends StatelessWidget {
|
||||
const _VideoButton({required this.video});
|
||||
|
||||
final VideoData video;
|
||||
|
||||
void _showVideoPlayer(BuildContext context, VideoData video) {
|
||||
if (video.youtubeId == null &&
|
||||
_videoControllerCache.containsKey(video.videoPath)) {
|
||||
// Dispose the cached controller to avoid codec conflict with dialog controller
|
||||
_videoControllerCache[video.videoPath]!.dispose();
|
||||
_videoControllerCache.remove(video.videoPath);
|
||||
}
|
||||
showVideoPlayerDialog(context, video);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
@@ -341,7 +444,7 @@ class _VideoButtonState extends State<_VideoButton> {
|
||||
color: Colors.white,
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
onTap: () => _showVideoPlayer(context, widget.video),
|
||||
onTap: () => _showVideoPlayer(context, video),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
@@ -353,29 +456,11 @@ class _VideoButtonState extends State<_VideoButton> {
|
||||
color: const Color(0xFFFFE6F1),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: _isInitialized && _controller != null
|
||||
? ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: FittedBox(
|
||||
fit: BoxFit.cover,
|
||||
child: SizedBox(
|
||||
width: _controller!.value.size.width,
|
||||
height: _controller!.value.size.height,
|
||||
child: VideoPlayer(_controller!),
|
||||
),
|
||||
),
|
||||
)
|
||||
: const Center(
|
||||
child: Icon(
|
||||
Icons.play_circle_fill_rounded,
|
||||
size: 48,
|
||||
color: VideoScreen._accentPink,
|
||||
),
|
||||
),
|
||||
child: VideoThumbnail(video: video),
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
widget.video.title,
|
||||
video.title,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w900,
|
||||
fontSize: 14,
|
||||
@@ -386,7 +471,7 @@ class _VideoButtonState extends State<_VideoButton> {
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
widget.video.description,
|
||||
video.description,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -401,17 +486,69 @@ class _VideoButtonState extends State<_VideoButton> {
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _showVideoPlayer(BuildContext context, VideoData video) {
|
||||
// Dispose the cached controller to avoid codec conflict with dialog controller
|
||||
if (_videoControllerCache.containsKey(video.videoPath)) {
|
||||
_videoControllerCache[video.videoPath]!.dispose();
|
||||
_videoControllerCache.remove(video.videoPath);
|
||||
}
|
||||
_controller = null;
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => _VideoPlayerDialog(video: video),
|
||||
class _YoutubePlayerDialog extends StatefulWidget {
|
||||
const _YoutubePlayerDialog({required this.video});
|
||||
|
||||
final VideoData video;
|
||||
|
||||
@override
|
||||
State<_YoutubePlayerDialog> createState() => _YoutubePlayerDialogState();
|
||||
}
|
||||
|
||||
class _YoutubePlayerDialogState extends State<_YoutubePlayerDialog> {
|
||||
late final YoutubePlayerController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = YoutubePlayerController(
|
||||
initialVideoId: widget.video.youtubeId!,
|
||||
flags: const YoutubePlayerFlags(autoPlay: true, mute: false),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_controller.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final size = MediaQuery.sizeOf(context);
|
||||
return Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
insetPadding: const EdgeInsets.all(16),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: VideoScreen._accentPink.withValues(alpha: 0.15),
|
||||
borderRadius: BorderRadius.circular(24),
|
||||
border: Border.all(color: VideoScreen._accentPink, width: 3),
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(21),
|
||||
child: SizedBox(
|
||||
width: size.width * 0.9,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
YoutubePlayer(controller: _controller),
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
color: VideoScreen._accentPink.withValues(alpha: 0.15),
|
||||
alignment: Alignment.centerRight,
|
||||
child: IconButton(
|
||||
icon: const Icon(Icons.close, color: Colors.white),
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -436,7 +573,7 @@ class _VideoPlayerDialogState extends State<_VideoPlayerDialog> {
|
||||
}
|
||||
|
||||
Future<void> _initializeVideo() async {
|
||||
_controller = VideoPlayerController.asset(widget.video.videoPath);
|
||||
_controller = VideoPlayerController.asset(widget.video.videoPath!);
|
||||
try {
|
||||
await _controller.initialize();
|
||||
if (mounted) {
|
||||
@@ -502,7 +639,7 @@ class _VideoPlayerDialogState extends State<_VideoPlayerDialog> {
|
||||
if (_isInitialized)
|
||||
_VideoControls(
|
||||
controller: _controller,
|
||||
videoPath: widget.video.videoPath,
|
||||
videoPath: widget.video.videoPath!,
|
||||
onClose: () => Navigator.of(context).pop(),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user