From 2ea841ae5317964c89b4a49e380837b9a120bdc1 Mon Sep 17 00:00:00 2001 From: AmirHany <87610278+AmirHany@users.noreply.github.com> Date: Wed, 23 Nov 2022 22:00:34 +0200 Subject: [PATCH] Chewie after update --- lib/src/chewie_player.dart | 49 ++++++++++++++++++++++++++++++++++---- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/lib/src/chewie_player.dart b/lib/src/chewie_player.dart index 23d075b72..bb8bac5ea 100644 --- a/lib/src/chewie_player.dart +++ b/lib/src/chewie_player.dart @@ -27,10 +27,12 @@ class Chewie extends StatefulWidget { const Chewie({ Key? key, required this.controller, + required this.user }) : super(key: key); /// The [ChewieController] final ChewieController controller; + final UserProfileModel user; @override ChewieState createState() { @@ -44,6 +46,11 @@ class ChewieState extends State { bool get isControllerFullScreen => widget.controller.isFullScreen; late PlayerNotifier notifier; + + bool waterMark = false; + late Timer _timer; + int _start = 0; + @override void initState() { super.initState(); @@ -99,10 +106,44 @@ class ChewieState extends State { ) { return Scaffold( resizeToAvoidBottomInset: false, - body: Container( - alignment: Alignment.center, - color: Colors.black, - child: controllerProvider, + body: Stack( + children:[ + Container( + alignment: Alignment.center, + color: Colors.black, + child: controllerProvider, + ), + StatefulBuilder(builder: (innerContext,update){ + _timer = Timer.periodic( + Duration(seconds: 30), + (Timer timer) { + if (_start == 0) { + //timer.cancel(); + waterMark = !waterMark; + _start = 60; + } else { + _start--; + //if(_start == 15) waterMark = !waterMark; + } + }, + ); + return Positioned( + child: Center( + child: Container( + alignment: waterMark ? Alignment.topRight:Alignment.bottomLeft, + margin: EdgeInsets.symmetric(vertical: 50,horizontal: 10), + child: Text( + "${user.email}", + style: TextStyle( + color: Colors.black + .withOpacity(0.1), + fontSize: 18, + fontWeight: FontWeight.w700), + ), + ), + )) ; + }), + ], ), ); }