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

Upgrade to Dart 3 and Flutter 3.10 #18

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 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 analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:very_good_analysis/analysis_options.2.4.0.yaml
include: package:very_good_analysis/analysis_options.5.0.0.yaml
linter:
rules:
public_member_api_docs: false
14 changes: 10 additions & 4 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 30
namespace "com.example.spacexDemo"
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

sourceSets {
main.java.srcDirs += 'src/main/kotlin'
Expand All @@ -41,8 +43,10 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.spacexDemo"
minSdkVersion 16
targetSdkVersion 30
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand Down Expand Up @@ -70,22 +74,24 @@ android {
production {
dimension "default"
applicationIdSuffix ""
manifestPlaceholders = [appName: "SpaceX Demo"]
}
staging {
dimension "default"
applicationIdSuffix ".stg"
manifestPlaceholders = [appName: "[STG] SpaceX Demo"]
}
development {
dimension "default"
applicationIdSuffix ".dev"
manifestPlaceholders = [appName: "[DEV] SpaceX Demo"]
}
}

buildTypes {
release {
signingConfig signingConfigs.release
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt')
}
debug {
Expand Down
22 changes: 11 additions & 11 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.spacexDemo">
<application
android:label="SpaceX Demo"
<queries>
<intent>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
</intent>
</queries>
<application
android:label="${appName}"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Expand All @@ -18,15 +27,6 @@
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<!-- Displays an Android View that continues showing the launch screen
Drawable until Flutter paints its first frame, then this splash
screen fades out. A splash screen is useful to avoid any visual
gap between the end of Android's launch screen and the painting of
Flutter's first frame. -->
<meta-data
android:name="io.flutter.embedding.android.SplashScreenDrawable"
android:resource="@drawable/launch_background"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
Expand Down
10 changes: 5 additions & 5 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
buildscript {
ext.kotlin_version = '1.3.50'
ext.kotlin_version = '1.7.10'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
org.gradle.jvmargs=-Xmx1024M
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
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.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
4 changes: 4 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,9 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
</array>
</dict>
</plist>
11 changes: 5 additions & 6 deletions lib/app/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ import 'package:spacex_demo/l10n/l10n.dart';

class App extends StatelessWidget {
const App({
Key? key,
required RocketRepository rocketRepository,
required CrewMemberRepository crewMemberRepository,
super.key,
}) : _rocketRepository = rocketRepository,
_crewMemberRepository = crewMemberRepository,
super(key: key);
_crewMemberRepository = crewMemberRepository;

final RocketRepository _rocketRepository;
final CrewMemberRepository _crewMemberRepository;
Expand All @@ -31,7 +30,7 @@ class App extends StatelessWidget {
}

class AppView extends StatelessWidget {
const AppView({Key? key}) : super(key: key);
const AppView({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -49,8 +48,8 @@ class AppView extends StatelessWidget {
),
elevatedButtonTheme: ElevatedButtonThemeData(
style: ElevatedButton.styleFrom(
primary: Colors.white,
onPrimary: Colors.black,
foregroundColor: Colors.black,
backgroundColor: Colors.white,
),
),
),
Expand Down
12 changes: 6 additions & 6 deletions lib/crew/view/crew_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import 'package:spacex_demo/crew_member_details/crew_member_details.dart';
import 'package:spacex_demo/l10n/l10n.dart';

class CrewPage extends StatelessWidget {
const CrewPage({Key? key}) : super(key: key);
const CrewPage({super.key});

static Route<CrewPage> route() {
static Route<void> route() {
return MaterialPageRoute(
builder: (context) => const CrewPage(),
builder: (_) => const CrewPage(),
);
}

Expand All @@ -26,7 +26,7 @@ class CrewPage extends StatelessWidget {
}

class CrewView extends StatelessWidget {
const CrewView({Key? key}) : super(key: key);
const CrewView({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -44,7 +44,7 @@ class CrewView extends StatelessWidget {
}

class _Content extends StatelessWidget {
const _Content({Key? key}) : super(key: key);
const _Content();

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -75,7 +75,7 @@ class _Content extends StatelessWidget {
}

class _CrewMembersList extends StatelessWidget {
const _CrewMembersList({Key? key}) : super(key: key);
const _CrewMembersList({super.key});

@override
Widget build(BuildContext context) {
Expand Down
10 changes: 5 additions & 5 deletions lib/crew_member_details/view/crew_member_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:spacex_demo/l10n/l10n.dart';
import 'package:url_launcher/url_launcher.dart';

class CrewMemberDetailsPage extends StatelessWidget {
const CrewMemberDetailsPage({Key? key}) : super(key: key);
const CrewMemberDetailsPage({super.key});

static Route<void> route({required CrewMember crewMember}) {
return MaterialPageRoute(
Expand All @@ -25,7 +25,7 @@ class CrewMemberDetailsPage extends StatelessWidget {
}

class CrewMemberDetailsView extends StatelessWidget {
const CrewMemberDetailsView({Key? key}) : super(key: key);
const CrewMemberDetailsView({super.key});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -61,10 +61,10 @@ class CrewMemberDetailsView extends StatelessWidget {
'crewMemberDetailsPage_openWikipedia_elevatedButton',
),
onPressed: () async {
final url = crewMember.wikipedia;
final uri = Uri.parse(crewMember.wikipedia);

if (await canLaunch(url)) {
await launch(url);
if (await canLaunchUrl(uri)) {
await launchUrl(uri);
}
},
child: Text(l10n.openWikipediaButtonText),
Expand Down
2 changes: 1 addition & 1 deletion lib/crew_member_details/widgets/image_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:spacex_demo/crew_member_details/cubit/crew_member_details_cubit.dart';

class ImageHeader extends StatelessWidget {
const ImageHeader({Key? key}) : super(key: key);
const ImageHeader({super.key});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/crew_member_details/widgets/title_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:spacex_demo/crew_member_details/cubit/crew_member_details_cubit.
import 'package:spacex_demo/l10n/l10n.dart';

class TitleHeader extends StatelessWidget {
const TitleHeader({Key? key}) : super(key: key);
const TitleHeader({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -19,7 +19,7 @@ class TitleHeader extends StatelessWidget {
children: [
Text(
crewMember.name,
style: Theme.of(context).textTheme.headline5,
style: Theme.of(context).textTheme.headlineSmall,
),
const SizedBox(width: 4),
if (crewMember.status == 'active')
Expand Down
2 changes: 1 addition & 1 deletion lib/home/view/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'package:spacex_demo/home/widgets/home_page_content.dart';
import 'package:spacex_demo/l10n/l10n.dart';

class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
const HomePage({super.key});

@override
Widget build(BuildContext context) {
Expand Down
2 changes: 1 addition & 1 deletion lib/home/widgets/home_page_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:spacex_demo/l10n/l10n.dart';
import 'package:spacex_demo/rockets/rockets.dart';

class HomePageContent extends StatelessWidget {
const HomePageContent({Key? key}) : super(key: key);
const HomePageContent({super.key});

@override
Widget build(BuildContext context) {
Expand Down
6 changes: 3 additions & 3 deletions lib/home/widgets/spacex_category_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import 'package:flutter/material.dart';

class SpaceXCategoryCard extends StatelessWidget {
const SpaceXCategoryCard({
Key? key,
required this.onTap,
required this.title,
required this.imageUrl,
}) : super(key: key);
super.key,
});

final VoidCallback onTap;
final Widget title;
Expand Down Expand Up @@ -40,7 +40,7 @@ class SpaceXCategoryCard extends StatelessWidget {
child: Align(
alignment: Alignment.centerLeft,
child: DefaultTextStyle.merge(
style: Theme.of(context).textTheme.headline4,
style: Theme.of(context).textTheme.headlineMedium,
child: title,
),
),
Expand Down
16 changes: 8 additions & 8 deletions lib/rocket_details/view/rocket_details_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:spacex_demo/rocket_details/rocket_details.dart';
import 'package:url_launcher/url_launcher.dart';

class RocketDetailsPage extends StatelessWidget {
const RocketDetailsPage({Key? key}) : super(key: key);
const RocketDetailsPage({super.key});

static Route<void> route({required Rocket rocket}) {
return MaterialPageRoute(
Expand All @@ -25,7 +25,7 @@ class RocketDetailsPage extends StatelessWidget {
}

class RocketDetailsView extends StatelessWidget {
const RocketDetailsView({Key? key}) : super(key: key);
const RocketDetailsView({super.key});

@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -75,10 +75,10 @@ class RocketDetailsView extends StatelessWidget {
'rocketDetailsPage_openWikipedia_elevatedButton',
),
onPressed: () async {
final url = rocket.wikipedia!;
final uri = Uri.parse(rocket.wikipedia!);

if (await canLaunch(url)) {
await launch(url);
if (await canLaunchUrl(uri)) {
await launchUrl(uri);
}
},
child: Text(l10n.openWikipediaButtonText),
Expand All @@ -92,7 +92,7 @@ class RocketDetailsView extends StatelessWidget {
}

class _ImageHeader extends StatelessWidget {
const _ImageHeader({Key? key}) : super(key: key);
const _ImageHeader({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -118,7 +118,7 @@ class _ImageHeader extends StatelessWidget {
}

class _TitleHeader extends StatelessWidget {
const _TitleHeader({Key? key}) : super(key: key);
const _TitleHeader({super.key});

@override
Widget build(BuildContext context) {
Expand All @@ -132,7 +132,7 @@ class _TitleHeader extends StatelessWidget {
children: [
Text(
rocket.name,
style: Theme.of(context).textTheme.headline5,
style: Theme.of(context).textTheme.headlineSmall,
),
if (rocket.active != null) ...[
const SizedBox(width: 4),
Expand Down
Loading