Skip to content

Commit

Permalink
- Updated entire project to make it compatible with the latest flutte…
Browse files Browse the repository at this point in the history
…r release,

- removed ads,
- added GitHub action for deployment
  • Loading branch information
bhavik-multipl committed Apr 6, 2023
1 parent 66ceaf3 commit 492d77b
Show file tree
Hide file tree
Showing 21 changed files with 179 additions and 191 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/build-and-deploy-to-playstore.yml
@@ -0,0 +1,47 @@
# GitHub action to Build and deploy to Play Store
name: Build and deploy to Play Store

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '12.x'

- name: Cache Flutter dependencies
uses: actions/cache@v2
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.lock') }}
restore-keys: ${{ runner.os }}-pub-cache-

- uses: subosito/flutter-action@v1.5.3
with:
channel: 'stable'

- name: Install dependencies
run: flutter pub get

- name: Build release app bundle
run: flutter build appbundle --release

- name: Authenticate with Google Play Console
uses: google-github-actions/setup-gcloud@master
with:
project_id: my-project-id
service_account_key: ${{ secrets.PLAY_STORE_AUTH_TOKEN }}
- name: Upload APK to Google Play Console
uses: google-github-actions/upload-google-play@master
with:
release_files: "build/app/outputs/bundle/release/app-release.aab"
track: "production"
package_name: "com.ibhavikmakwana.flutterplayground"
service_account_key: ${{ secrets.PLAY_STORE_AUTH_TOKEN }}
4 changes: 2 additions & 2 deletions android/app/build.gradle
Expand Up @@ -32,7 +32,7 @@ if (keystorePropertiesFile.exists()) {
}

android {
compileSdkVersion 30
compileSdkVersion 33

sourceSets {

Expand All @@ -47,7 +47,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.ibhavikmakwana.flutterplayground"
minSdkVersion 21
targetSdkVersion 30
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.4.20'
ext.kotlin_version = '1.7.10'
repositories {
google()
jcenter()
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
9 changes: 3 additions & 6 deletions lib/ExampleNameItem.dart
Expand Up @@ -4,7 +4,6 @@

import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:flutter/material.dart';
import 'package:flutter_playground/models/ExapmleNames.dart';
import 'package:flutter_playground/values/imports.dart';

/// A [ExampleNameItem] to display a [ExampleNames].
Expand All @@ -30,23 +29,21 @@ class ExampleNameItem extends StatelessWidget {
border: Border(
left: BorderSide(
width: 4.0,
color: Theme.of(context).accentColor,
color: Theme.of(context).colorScheme.secondary,
),
),
),
child: InkWell(
onTap: () {
Navigator.pushNamed(context, "/${exampleNames.title}");
FirebaseAnalytics()
.setCurrentScreen(screenName: exampleNames.title);
FirebaseAnalytics.instance.setCurrentScreen(screenName: exampleNames.title);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Expanded(
child: Container(
margin: const EdgeInsets.symmetric(
vertical: 16.0, horizontal: 8.0),
margin: const EdgeInsets.symmetric(vertical: 16.0, horizontal: 8.0),
child: Text(
exampleNames.title,
softWrap: true,
Expand Down
2 changes: 1 addition & 1 deletion lib/ads/test_ad_helper.dart
Expand Up @@ -5,7 +5,7 @@ class AdHelper {
if (Platform.isAndroid) {
return "ca-app-pub-3940256099942544/6300978111";
} else {
throw new UnsupportedError("Unsupported platform");
throw UnsupportedError("Unsupported platform");
}
}
}
14 changes: 6 additions & 8 deletions lib/my_app.dart
Expand Up @@ -2,19 +2,17 @@ import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_analytics/observer.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter_playground/store/theme_store.dart';
import 'package:flutter_playground/ui_ux/home_page/my_home_page.dart';
import 'package:flutter_playground/ui_ux/home_page/my_home_page_store.dart';
import 'package:flutter_playground/utils/Strings.dart';
import 'package:flutter_playground/values/routes.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:provider/provider.dart';

import 'package:flutter_playground/store/theme_store.dart';
import 'package:flutter_playground/ui_ux/home_page/my_home_page_store.dart';
import 'package:flutter_playground/utils/Strings.dart';

class MyApp extends StatelessObserverWidget {
static FirebaseAnalytics analytics = FirebaseAnalytics();
static FirebaseAnalyticsObserver observer =
FirebaseAnalyticsObserver(analytics: analytics);
static FirebaseAnalytics analytics = FirebaseAnalytics.instance;
static FirebaseAnalyticsObserver observer = FirebaseAnalyticsObserver(analytics: analytics);

@override
Widget build(BuildContext context) {
Expand All @@ -35,7 +33,7 @@ class MyApp extends StatelessObserverWidget {
create: (context) => MyHomePageStore()..initList(),
child: const MyHomePage(title: Strings.appName),
),
routes: DefaultRoutes.routes(),
routes: DefaultRoutes().routes(),
);
}
}
2 changes: 1 addition & 1 deletion lib/ui/animatedswitcher/AnimatedSwitcherExample.dart
Expand Up @@ -54,7 +54,7 @@ class _AnimatedSwitcherExampleState extends State<AnimatedSwitcherExample> {
// child each time the count changes, so that it will begin its animation
// when the count changes.
key: ValueKey<int>(_counter),
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
),
),
],
Expand Down
11 changes: 7 additions & 4 deletions lib/ui/app_bar/AppBarExample.dart
Expand Up @@ -68,12 +68,15 @@ class AppBarExample extends StatelessWidget {
],
iconTheme: const IconThemeData(
color: Colors.black,
),
textTheme: const TextTheme(
headline6: TextStyle(
), toolbarTextStyle: const TextTheme(
titleLarge: TextStyle(
color: Colors.black,
),
),
).bodyMedium, titleTextStyle: const TextTheme(
titleLarge: TextStyle(
color: Colors.black,
),
).titleLarge,
),
),

Expand Down
1 change: 0 additions & 1 deletion lib/ui/cupertino/CupertinoActionSheetExample.dart
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class CupertinoActionSheetExample extends StatelessWidget {
final String title;
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/drawer/NavigationDrawer.dart
Expand Up @@ -5,12 +5,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_playground/utils/Strings.dart';

class NavigationDrawer extends StatefulWidget {
class NavigationDrawerExample extends StatefulWidget {
@override
_NavigationDrawerState createState() => _NavigationDrawerState();
_NavigationDrawerExampleState createState() => _NavigationDrawerExampleState();
}

class _NavigationDrawerState extends State<NavigationDrawer> {
class _NavigationDrawerExampleState extends State<NavigationDrawerExample> {
bool _isVisible = true;

String _title = "Navigation Example";
Expand Down
16 changes: 8 additions & 8 deletions lib/ui/hardwarekey/RawKeyboardDemo.dart
Expand Up @@ -49,12 +49,12 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
onTap: () {
FocusScope.of(context).requestFocus(_focusNode);
},
child: Text('Tap to focus', style: textTheme.headline4),
child: Text('Tap to focus', style: textTheme.headlineMedium),
);
}

if (_event == null) {
return Text('Press Volume key', style: textTheme.headline4);
return Text('Press Volume key', style: textTheme.headlineMedium);
}

int? flags;
Expand All @@ -75,12 +75,12 @@ class _HardwareKeyDemoState extends State<RawKeyboardDemo> {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text('${_event.runtimeType}', style: textTheme.subtitle1),
Text('flags: $flags', style: textTheme.subtitle1),
Text('codePoint: $codePoint', style: textTheme.subtitle1),
Text('keyCode: $keyCode', style: textTheme.subtitle1),
Text('scanCode: $scanCode', style: textTheme.subtitle1),
Text('metaState: $metaState', style: textTheme.subtitle1),
Text('${_event.runtimeType}', style: textTheme.titleMedium),
Text('flags: $flags', style: textTheme.titleMedium),
Text('codePoint: $codePoint', style: textTheme.titleMedium),
Text('keyCode: $keyCode', style: textTheme.titleMedium),
Text('scanCode: $scanCode', style: textTheme.titleMedium),
Text('metaState: $metaState', style: textTheme.titleMedium),
],
);
},
Expand Down
5 changes: 2 additions & 3 deletions lib/ui/lifecycle/Lifecycle.dart
Expand Up @@ -3,7 +3,6 @@
// found in the LICENSE file.

import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';

class Lifecycle extends StatefulWidget {
final String title;
Expand All @@ -20,13 +19,13 @@ class _LifecycleState extends State<Lifecycle> with WidgetsBindingObserver {
@override
void initState() {
super.initState();
WidgetsBinding.instance!.addObserver(this);
WidgetsBinding.instance.addObserver(this);
}

@override
void dispose() {
super.dispose();
WidgetsBinding.instance!.removeObserver(this);
WidgetsBinding.instance.removeObserver(this);
}

@override
Expand Down
3 changes: 1 addition & 2 deletions lib/ui/progressbutton/ProgressButton.dart
Expand Up @@ -47,9 +47,8 @@ class _ProgressButtonState extends State<ProgressButton>
width: _width,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.all(0.0),
padding: const EdgeInsets.all(0.0), backgroundColor: Colors.lightGreen,
elevation: 4.0,
primary: Colors.lightGreen,
),
onPressed: () {
setState(() {
Expand Down
4 changes: 1 addition & 3 deletions lib/ui/text/TextExamples.dart
Expand Up @@ -46,9 +46,7 @@ class _TextExamplesState extends State<TextExamples> {
padding: const EdgeInsets.all(8.0),
child: TextButton(
style: TextButton.styleFrom(
shape: const RoundedRectangleBorder(),
primary: Colors.red,
onSurface: Colors.white,
foregroundColor: Colors.red, shape: const RoundedRectangleBorder(), disabledForegroundColor: Colors.white.withOpacity(0.38),
),
onPressed: () {
Navigator.pushNamed(context, route);
Expand Down
1 change: 0 additions & 1 deletion lib/ui/tooltip/tooltip.dart
Expand Up @@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class ToolTipExample extends StatelessWidget {
Expand Down

0 comments on commit 492d77b

Please sign in to comment.