Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(Widget): Add overlay actions to trailer screen #34

Merged
merged 6 commits into from
Jun 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ documentation:
- any: ['README.md','doc/**/*']

chores:
- any: ['.gitignore']
- any: ['.gitignore','README.md','.github/**/*']

native/android:
- any: ['android/**/*']
Expand Down
68 changes: 62 additions & 6 deletions .github/workflows/PR-merge-build-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
branches:
- master
types: [ closed ]
paths-ignore: ['doc/**','**.md','.gitignore','Prototype/**','.github/**']
paths-ignore: ['doc/**','**.md','.gitignore','Prototype/**']

workflow_dispatch:

Expand Down Expand Up @@ -45,17 +45,41 @@ jobs:
gpg -d --passphrase "$KEYSTORE_PASSPHRASE" --batch "$KEYSTORE_FILENAME.asc" > "./android/$KEYSTORE_FILENAME"
- name: Generate key properties
run: |
echo "storeFile=$KEYSTORE_FILENAME" > ./android/key.properties
echo "storePassword=$KEYSTORE_PASSPHRASE" > ./android/key.properties
echo "keyPassword=$KEYSTORE_PASSPHRASE" > ./android/key.properties
echo "keyAlias=$KEY_ALIAS" > ./android/key.properties
echo "storeFile=../$KEYSTORE_FILENAME" > ./android/key.properties
echo "storePassword=$KEYSTORE_PASSPHRASE" >> ./android/key.properties
echo "keyPassword=$KEYSTORE_PASSPHRASE" >> ./android/key.properties
echo "keyAlias=$KEY_ALIAS" >> ./android/key.properties
- name: Upload Keystore Artifact
uses: actions/[email protected]
with:
name: keystore-artifact
path: android/${{ env.KEYSTORE_FILENAME }}
if-no-files-found: error
retention-days: 1
- name: Upload Key Properties Artifact
uses: actions/[email protected]
with:
name: key-properties-artifact
path: android/key.properties
if-no-files-found: error
retention-days: 1

build-release:
needs: [flutter-setup,assemble-release]
name: Build Release APKS
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download Keystore Artifact
uses: actions/[email protected]
with:
name: keystore-artifact #Must be same as upload artifact in previous job
path: android #Download to android directory
- name: Download Key Properties Artifact
uses: actions/[email protected]
with:
name: key-properties-artifact #Must be same as upload artifact in previous job
path: android #Download to android directory
- uses: actions/setup-java@v1
with:
java-version: '12.x'
Expand All @@ -67,14 +91,28 @@ jobs:
run: flutter pub get
- name: Run build runner for codegen files
run: flutter packages pub run build_runner build --delete-conflicting-outputs
- name: Generate splitted release apks
- name: Generate Splitted Release APKs
run: flutter build apk --target-platform android-arm,android-arm64 --split-per-abi --obfuscate --split-debug-info=./ez_tickets_app/debug_trace
- name: Remove bundled APK
run: rm build/app/outputs/flutter-apk/app.apk
- name: Upload Built APKs Artifact
uses: actions/[email protected]
with:
name: built-apks-artifact
path: 'build/app/outputs/flutter-apk/*.apk'
if-no-files-found: error
retention-days: 1

release-artifacts-upload:
needs: [build-release]
name: Upload APKS to release artifacts
runs-on: ubuntu-latest
steps:
- name: Download Built APKs Artifact
uses: actions/[email protected]
with:
name: built-apks-artifact #Must be same as upload artifact in previous job
path: build/app/outputs/flutter-apk #download all apks to flutter-apk dir
- name: Bump version and push tag
id: generate_tag
uses: mathieudutour/[email protected]
Expand All @@ -96,6 +134,11 @@ jobs:
name: Upload APKS to google drive
runs-on: ubuntu-latest
steps:
- name: Download Built APKs Artifact
uses: actions/[email protected]
with:
name: built-apks-artifact #Must be same as upload artifact in previous job
path: build/app/outputs/flutter-apk #download all apks to flutter-apk dir
- name: Upload apks to google drive
uses: mkrakowitzer/actions-googledrive@1
with:
Expand All @@ -105,3 +148,16 @@ jobs:
google-client-id: ${{ secrets.DRIVE_CLIENT_ID }}
google-client-secret: ${{ secrets.DRIVE_CLIENT_SECRET }}
remove-outdated: 'false'

cleanup_job:
needs: [ google-drive-upload, release-artifacts-upload ]
runs-on: ubuntu-latest
steps:
- name: Delete All Artifacts
uses: GeekyEggo/[email protected]
with:
name: |
keystore-artifact
key-properties-artifact
built-apks-artifact
failOnError: false
5 changes: 2 additions & 3 deletions .github/workflows/PR-open-test-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Test PR and Push
on:
pull_request:
branches: [release,dev,master]
paths-ignore: ['doc/**','**.md','.gitignore','Prototype/**','.github/**']
jobs:
build:
name: Test APK
Expand All @@ -18,9 +17,9 @@ jobs:
channel: 'stable'
- name: Get Pub Dependencies
run: flutter pub get
- name: Run build runner for codegen files
- name: Run Build Runner For Codegen Files
run: flutter packages pub run build_runner build --delete-conflicting-outputs
- name: Run Dart Analyzer
run: flutter analyze .
- name: Attempt release build generation
- name: Attempt Debug APK Build
run: flutter build apk --debug
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.inceptrafay.ez_ticketz_app"
minSdkVersion 16
minSdkVersion 17
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
166 changes: 116 additions & 50 deletions lib/views/screens/trailer_screen.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import 'package:auto_route/auto_route.dart';
import 'package:better_player/better_player.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

// Helpers
import '../../helper/utils/constants.dart';
import '../../helper/extensions/context_extensions.dart';

//Providers
import '../../providers/movies_provider.dart';
import '../widgets/trailer/overlay_back_button.dart';

//Widgets
import '../widgets/trailer/overlay_black_header.dart';
import '../widgets/trailer/overlay_movie_title.dart';
import '../widgets/trailer/overlay_play_pause_button.dart';

class TrailerScreen extends StatefulWidget {
const TrailerScreen();
Expand All @@ -21,18 +25,26 @@ class TrailerScreen extends StatefulWidget {
class _TrailerScreenState extends State<TrailerScreen> {
late final BetterPlayerController _betterPlayerController;

final _controlsConfiguration = const BetterPlayerControlsConfiguration(
overflowModalTextColor: Constants.textGreyColor,
overflowMenuIconsColor: Constants.textGreyColor,
overflowModalColor: Constants.scaffoldGreyColor,
progressBarPlayedColor: Constants.primaryColor,
progressBarHandleColor: Constants.primaryColor,
backgroundColor: Colors.black38,
controlBarColor: Colors.black54,
enablePip: false,
enableSubtitles: false,
static const _controlsConfiguration = BetterPlayerControlsConfiguration(
overflowModalTextColor: Constants.textGreyColor,
overflowMenuIconsColor: Constants.textGreyColor,
overflowModalColor: Constants.scaffoldGreyColor,
progressBarPlayedColor: Constants.primaryColor,
progressBarHandleColor: Constants.primaryColor,
progressBarBufferedColor: Color(0x72ed0000),
backgroundColor: Colors.black38,
controlBarColor: Colors.black54,
loadingColor: Constants.redColor,
enablePip: false,
enableSubtitles: false,
controlBarHeight: 60,
);

static const _exitFullScreenOrientations = <DeviceOrientation>[
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
];

@override
void initState() {
super.initState();
Expand All @@ -41,16 +53,14 @@ class _TrailerScreenState extends State<TrailerScreen> {
fullScreenAspectRatio: 16 / 9,
looping: false,
autoPlay: true,
fit: BoxFit.cover,
allowedScreenSleep: false,
deviceOrientationsAfterFullScreen: [
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
],
systemOverlaysAfterFullScreen: [SystemUiOverlay.top],
fullScreenByDefault: true,
allowedScreenSleep: false,
autoDetectFullscreenDeviceOrientation: true,
fit: BoxFit.cover,
controlsConfiguration: _controlsConfiguration,
deviceOrientationsAfterFullScreen: _exitFullScreenOrientations,
systemOverlaysAfterFullScreen: [SystemUiOverlay.top],
routePageBuilder: _fullScreenRouteBuilder,
errorBuilder: _buildErrorWidget,
);
final trailerUrl = context.read(selectedMovieProvider).state.trailerUrl;
Expand All @@ -64,44 +74,100 @@ class _TrailerScreenState extends State<TrailerScreen> {
);
}

/// List of overlay widgets for the player that add useful functionalities,
/// like Back Navigation, Play/Pause ability or Movie Title.
List<Widget> buildOverlayWidgets() {
return [
//Black overlay header
Align(
alignment: Alignment.topCenter,
child: OverlayBlackHeader(
betterPlayerController: _betterPlayerController,
),
),

//Movie title
Align(
alignment: Alignment.topCenter,
child: Padding(
padding: const EdgeInsets.only(top: 20),
child: OverlayMovieTitle(
betterPlayerController: _betterPlayerController,
),
),
),

//Back button
Align(
alignment: Alignment.topLeft,
child: OverlayBackButton(
betterPlayerController: _betterPlayerController,
),
),

//Play/Pause Button
Align(
alignment: _betterPlayerController.isFullScreen
? Alignment.center
: Alignment.topCenter,
child: Padding(
padding: _betterPlayerController.isFullScreen
? const EdgeInsets.all(0)
: const EdgeInsets.only(top: 105),
child: OverlayPlayPauseButton(
betterPlayerController: _betterPlayerController,
),
),
),
];
}

/// Defines the builder for the new route that gets pushed on
/// the fullscreen mode.
Widget _fullScreenRouteBuilder(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
BetterPlayerControllerProvider provider,
) {
return Scaffold(
resizeToAvoidBottomInset: false,
body: AnimatedBuilder(
animation: animation,
builder: (ctx, _) => Stack(
children: [
//Video Player
Container(
alignment: Alignment.center,
child: provider,
),

//Overlay widgets
...buildOverlayWidgets()
],
),
),
);
}

@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.black,
body: SafeArea(
child: Column(
child: Stack(
children: [
const SizedBox(height: 20),

//Back and title
Row(
children: [
const SizedBox(width: 15),
GestureDetector(
child: const Icon(Icons.arrow_back_sharp, size: 26),
onTap: () {
context.router.pop();
},
),

const SizedBox(width: 20),

//Movie Title
Expanded(
child: Consumer(
builder: (_, watch, __) {
final title = watch(selectedMovieProvider).state.title;
return Text(
title,
maxLines: 1,
style: context.headline3.copyWith(fontSize: 22),
);
},
),
),
],
//Video Player
Positioned(
top: 5,
right: 0,
left: 0,
child: BetterPlayer(controller: _betterPlayerController),
),

Expanded(child: BetterPlayer(controller: _betterPlayerController)),
//Overlay widgets
...buildOverlayWidgets(),
],
),
),
Expand Down
Loading