Skip to content
This repository was archived by the owner on Jan 8, 2025. It is now read-only.

Commit 56d9aaa

Browse files
Fix for Flutter 3.x (#87)
* apply dart fix * fixes for share plus * removing problematic package * update * upgrade android version * upgrading and fixing few issues * more fixes * more fixes * more fixes * more fixes * more fixes * more fixes * fix more errors * android fixes
1 parent 7176ae2 commit 56d9aaa

File tree

189 files changed

+4604
-3772
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

189 files changed

+4604
-3772
lines changed

.metadata

+22-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,30 @@
11
# This file tracks properties of this Flutter project.
22
# Used by Flutter tool to assess capabilities and perform upgrades etc.
33
#
4-
# This file should be version controlled and should not be manually edited.
4+
# This file should be version controlled.
55

66
version:
7-
revision: 5391447fae6209bb21a89e6a5a6583cac1af9b4b
7+
revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
88
channel: stable
99

1010
project_type: app
11+
12+
# Tracks metadata for the flutter migrate command
13+
migration:
14+
platforms:
15+
- platform: root
16+
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
17+
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
18+
- platform: android
19+
create_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
20+
base_revision: b8f7f1f9869bb2d116aa6a70dbeac61000b52849
21+
22+
# User provided section
23+
24+
# List of Local paths (relative to this file) that should be
25+
# ignored by the migrate tool.
26+
#
27+
# Files that are not part of the templates will be ignored by default.
28+
unmanaged_files:
29+
- 'lib/main.dart'
30+
- 'ios/Runner.xcodeproj/project.pbxproj'

analysis_options.yaml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
18+
#
19+
# Instead of disabling a lint rule for the entire project in the
20+
# section below, it can also be suppressed for a single line of code
21+
# or a specific dart file by using the `// ignore: name_of_lint` and
22+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23+
# producing the lint.
24+
rules:
25+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27+
28+
# Additional information about this file can be found at
29+
# https://dart.dev/guides/language/analysis-options

android/app/build.gradle

+13-8
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,26 @@ apply plugin: 'kotlin-android'
2626
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2727

2828
android {
29-
compileSdkVersion 28
29+
compileSdkVersion 33
30+
ndkVersion flutter.ndkVersion
3031

31-
sourceSets {
32-
main.java.srcDirs += 'src/main/kotlin'
32+
compileOptions {
33+
sourceCompatibility JavaVersion.VERSION_1_8
34+
targetCompatibility JavaVersion.VERSION_1_8
35+
}
36+
37+
kotlinOptions {
38+
jvmTarget = '1.8'
3339
}
3440

35-
lintOptions {
36-
disable 'InvalidPackage'
41+
sourceSets {
42+
main.java.srcDirs += 'src/main/kotlin'
3743
}
3844

3945
defaultConfig {
40-
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
4146
applicationId "com.popupbits.flutteruichallenges"
42-
minSdkVersion 16
43-
targetSdkVersion 28
47+
minSdkVersion flutter.minSdkVersion
48+
targetSdkVersion 33
4449
versionCode flutterVersionCode.toInteger()
4550
versionName flutterVersionName
4651
}

android/app/src/main/AndroidManifest.xml

+2-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.popupbits.flutteruichallenges">
3-
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
4-
calls FlutterMain.startInitialization(this); in its onCreate method.
5-
In most cases you can leave this as-is, but you if you want to provide
6-
additional functionality it is fine to subclass or reimplement
7-
FlutterApplication and put your custom class here. -->
83
<application
9-
android:name="io.flutter.app.FlutterApplication"
4+
android:name="${applicationName}"
105
android:label="flutteruichallenges"
116
android:icon="@mipmap/ic_launcher">
127
<activity
138
android:name=".MainActivity"
9+
android:exported="true"
1410
android:launchMode="singleTop"
1511
android:theme="@style/LaunchTheme"
1612
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
@@ -24,15 +20,6 @@
2420
android:name="io.flutter.embedding.android.NormalTheme"
2521
android:resource="@style/NormalTheme"
2622
/>
27-
<!-- Displays an Android View that continues showing the launch screen
28-
Drawable until Flutter paints its first frame, then this splash
29-
screen fades out. A splash screen is useful to avoid any visual
30-
gap between the end of Android's launch screen and the painting of
31-
Flutter's first frame. -->
32-
<meta-data
33-
android:name="io.flutter.embedding.android.SplashScreenDrawable"
34-
android:resource="@drawable/launch_background"
35-
/>
3623
<intent-filter>
3724
<action android:name="android.intent.action.MAIN"/>
3825
<category android:name="android.intent.category.LAUNCHER"/>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Modify this file to customize your launch splash screen -->
3+
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
4+
<item android:drawable="?android:colorBackground" />
5+
6+
<!-- You can insert your own image assets here -->
7+
<!-- <item>
8+
<bitmap
9+
android:gravity="center"
10+
android:src="@mipmap/launch_image" />
11+
</item> -->
12+
</layer-list>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
4+
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
5+
<!-- Show a splash screen on the activity. Automatically removed when
6+
the Flutter engine draws its first frame -->
7+
<item name="android:windowBackground">@drawable/launch_background</item>
8+
</style>
9+
<!-- Theme applied to the Android Window as soon as the process has started.
10+
This theme determines the color of the Android Window while your
11+
Flutter UI initializes, as well as behind your Flutter UI while its
12+
running.
13+
14+
This Theme is only used starting with V2 of Flutter's Android embedding. -->
15+
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
16+
<item name="android:windowBackground">?android:colorBackground</item>
17+
</style>
18+
</resources>

android/build.gradle

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
buildscript {
2-
ext.kotlin_version = '1.3.50'
2+
ext.kotlin_version = '1.6.10'
33
repositories {
44
google()
5-
jcenter()
5+
mavenCentral()
66
}
77

88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.5.0'
9+
classpath 'com.android.tools.build:gradle:7.1.2'
1010
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1111
}
1212
}
1313

1414
allprojects {
1515
repositories {
1616
google()
17-
jcenter()
17+
mavenCentral()
1818
}
1919
}
2020

android/gradle.properties

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536M
2-
android.enableR8=true
32
android.useAndroidX=true
43
android.enableJetifier=true
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Fri Jun 23 08:50:38 CEST 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

android/settings.gradle

+7-11
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
include ':app'
22

3-
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
3+
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
4+
def properties = new Properties()
45

5-
def plugins = new Properties()
6-
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7-
if (pluginsFile.exists()) {
8-
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
9-
}
6+
assert localPropertiesFile.exists()
7+
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
108

11-
plugins.each { name, path ->
12-
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13-
include ":$name"
14-
project(":$name").projectDir = pluginDirectory
15-
}
9+
def flutterSdkPath = properties.getProperty("flutter.sdk")
10+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
11+
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"

lib/core/constants.dart

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,5 @@ const List<Developer> DEVELOPERS = [
3030
),
3131
];
3232

33-
const String privacyUrl = "https://popupbits.com/contact/flutter-ui-challenges-privacy-policy/";
33+
const String privacyUrl =
34+
"https://popupbits.com/contact/flutter-ui-challenges-privacy-policy/";

lib/core/data/models/developer.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@ class Developer {
55
final String? address;
66
final String? github;
77

8-
const Developer({this.name, this.github, this.imageUrl, this.profession, this.address});
9-
}
8+
const Developer(
9+
{this.name, this.github, this.imageUrl, this.profession, this.address});
10+
}

lib/core/data/models/menu.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
import 'package:flutter/material.dart';
1+
import 'package:flutter/material.dart' hide MenuItem;
32

43
class MenuItem {
54
final String title;

lib/core/presentation/pages/main_menu.dart

+11-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*/
55

66
import 'package:flutter/material.dart';
7-
import 'package:flutter_ui_challenges/core/data/models/menu.dart';
7+
import 'package:flutter_ui_challenges/core/data/models/menu.dart' as menu;
88
import 'package:flutter_ui_challenges/core/presentation/widgets/preview.dart';
99
import 'package:flutter_ui_challenges/core/presentation/widgets/rounded_bordered_container.dart';
1010
import 'package:flutter_ui_challenges/src/pages/bike/bike_details.dart';
@@ -30,7 +30,7 @@ class _MainMenuState extends State<MainMenu> {
3030
return ListView(
3131
physics: BouncingScrollPhysics(),
3232
children: <Widget>[
33-
...pages.map((page) => page is MenuItem
33+
...pages.map((page) => page is menu.MenuItem
3434
? _buildExpandableMenu(page, context)
3535
: BorderedContainer(
3636
margin: const EdgeInsets.symmetric(
@@ -43,7 +43,7 @@ class _MainMenuState extends State<MainMenu> {
4343
);
4444
}
4545

46-
Widget _buildExpandableMenu(MenuItem page, BuildContext context) {
46+
Widget _buildExpandableMenu(menu.MenuItem page, BuildContext context) {
4747
return RoundedContainer(
4848
margin: EdgeInsets.symmetric(
4949
horizontal:
@@ -69,13 +69,14 @@ class _MainMenuState extends State<MainMenu> {
6969
);
7070
}
7171

72-
List<Widget> _buildSubMenus(List<SubMenuItem> items, BuildContext context) {
72+
List<Widget> _buildSubMenus(
73+
List<menu.SubMenuItem> items, BuildContext context) {
7374
final List<Widget> subMenus = [];
7475
items.forEach((item) => subMenus.add(_buildSubMenu(item, context)));
7576
return subMenus;
7677
}
7778

78-
Widget _buildSubMenu(SubMenuItem item, BuildContext context) {
79+
Widget _buildSubMenu(menu.SubMenuItem item, BuildContext context) {
7980
return Padding(
8081
padding: const EdgeInsets.only(left: 32.0),
8182
child: ListTile(
@@ -88,7 +89,7 @@ class _MainMenuState extends State<MainMenu> {
8889
children: <Widget>[
8990
IconButton(
9091
icon: Icon(Icons.code),
91-
onPressed: () => _openPage(context, item, OpenMode.CODE),
92+
onPressed: () => _openPage(context, item, menu.OpenMode.CODE),
9293
),
9394
],
9495
),
@@ -99,16 +100,17 @@ class _MainMenuState extends State<MainMenu> {
99100
.subtitle1!
100101
.copyWith(color: Colors.black87),
101102
),
102-
onTap: () => _openPage(context, item, OpenMode.PREVIEW),
103+
onTap: () => _openPage(context, item, menu.OpenMode.PREVIEW),
103104
),
104105
);
105106
}
106107

107-
void _openPage(BuildContext context, SubMenuItem item, OpenMode mode) {
108+
void _openPage(
109+
BuildContext context, menu.SubMenuItem item, menu.OpenMode mode) {
108110
Navigator.push(
109111
context,
110112
MaterialPageRoute(
111-
builder: (context) => mode == OpenMode.CODE
113+
builder: (context) => mode == menu.OpenMode.CODE
112114
? DesignPreviewsPage(
113115
page: item.page, title: item.title, path: item.path)
114116
: item.page,

lib/core/presentation/res/assets.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,16 @@ const String pineapple =
133133
const String vegetables =
134134
'https://firebasestorage.googleapis.com/v0/b/dl-flutter-ui-challenges.appspot.com/o/grocery%2Fvegetables.png?alt=mediroom4ia';
135135

136-
const INVITE_ILLUSTRATION = "https://firebasestorage.googleapis.com/v0/b/dl-flutter-ui-challenges.appspot.com/o/img%2Finvite.png?alt=media";
136+
const INVITE_ILLUSTRATION =
137+
"https://firebasestorage.googleapis.com/v0/b/dl-flutter-ui-challenges.appspot.com/o/img%2Finvite.png?alt=media";
137138

138-
const String bike = "https://firebasestorage.googleapis.com/v0/b/dl-flutter-ui-challenges.appspot.com/o/bike%2Fbike1.jpg?alt=media";
139+
const String bike =
140+
"https://firebasestorage.googleapis.com/v0/b/dl-flutter-ui-challenges.appspot.com/o/bike%2Fbike1.jpg?alt=media";
139141

140142
const String room4 = "assets/hotel/room4.jpg";
141143

142144
const List<String> introIllus = [
143145
'https://firebasestorage.googleapis.com/v0/b/dl-flutter-ui-challenges.appspot.com/o/intro%2F1.png?alt=media',
144146
'https://firebasestorage.googleapis.com/v0/b/dl-flutter-ui-challenges.appspot.com/o/intro%2F2.png?alt=media',
145147
'https://firebasestorage.googleapis.com/v0/b/dl-flutter-ui-challenges.appspot.com/o/intro%2F3.png?alt=media'
146-
];
148+
];

lib/core/presentation/res/code_highlighter.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Author: Damodar Lohani
77
* profile: https://github.com/lohanidamodar
88
*/
9-
9+
1010
import 'package:flutter/material.dart';
1111
import 'package:string_scanner/string_scanner.dart';
1212

@@ -367,4 +367,4 @@ class _HighlightSpan {
367367
else
368368
return style!.baseStyle;
369369
}
370-
}
370+
}

lib/core/presentation/res/colors.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import 'package:flutter/material.dart';
22

33
final Color bgColor = Color(0xfff2f2f2);
4-
final Color borderColor = Color(0xffd6d6d6);
4+
final Color borderColor = Color(0xffd6d6d6);

lib/core/presentation/res/functions.dart

+5-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ PreferredSize customAppBar({required BuildContext context}) {
44
return PreferredSize(
55
preferredSize: Size.fromHeight(100),
66
child: Container(
7-
height: kToolbarHeight+20,
7+
height: kToolbarHeight + 20,
88
child: ListTile(
99
contentPadding: const EdgeInsets.all(0),
1010
trailing: Container(
@@ -20,7 +20,10 @@ PreferredSize customAppBar({required BuildContext context}) {
2020
),
2121
),
2222
title: Padding(
23-
padding: const EdgeInsets.only(top: 35.0, left: 16.0,),
23+
padding: const EdgeInsets.only(
24+
top: 35.0,
25+
left: 16.0,
26+
),
2427
),
2528
),
2629
),

0 commit comments

Comments
 (0)