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

use AndroidX with 29 API to prevent build failures #1

Closed
wants to merge 6 commits into from
Closed
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
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 27
compileSdkVersion 29

lintOptions {
disable 'InvalidPackage'
Expand All @@ -35,7 +35,7 @@ android {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "co.appbrewery.bmicalculator"
minSdkVersion 16
targetSdkVersion 27
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand Down
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<application
android:name="io.flutter.app.FlutterApplication"
android:label="bmi_calculator"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/ic_launcher"
android:theme="@style/LaunchTheme">
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
Expand Down
4 changes: 4 additions & 0 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
<!-- Show a splash screen on the activity. Automatically removed when
Flutter draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
<item name="android:windowFullscreen">true</item>
<!-- put app content into cut-out area also -->
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
</style>
</resources>
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.android.tools.build:gradle:4.0.0-alpha08'
}
}

Expand Down
5 changes: 4 additions & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
org.gradle.jvmargs=-Xmx700M
android.enableR8=true
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-4.10.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-rc-2-all.zip
6 changes: 3 additions & 3 deletions ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=/Users/philippmuellauer/Developer/flutter"
export "FLUTTER_APPLICATION_PATH=/Users/philippmuellauer/Documents/Flutter/Flutter Complete/bmi-calculator"
export "FLUTTER_ROOT=/home/max/Flutter"
export "FLUTTER_APPLICATION_PATH=/home/max/Projects/appbrewery/BMI-Calculator-Flutter-Completed"
export "FLUTTER_TARGET=lib/main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build/ios"
export "FLUTTER_FRAMEWORK_DIR=/Users/philippmuellauer/Developer/flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_FRAMEWORK_DIR=/home/max/Flutter/bin/cache/artifacts/engine/ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
24 changes: 10 additions & 14 deletions lib/components/bottom_button.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:bmi_calculator/constants.dart';
import 'package:flutter/widgets.dart';

class BottomButton extends StatelessWidget {
BottomButton({@required this.onTap, @required this.buttonTitle});
Expand All @@ -9,20 +11,14 @@ class BottomButton extends StatelessWidget {

@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
child: Center(
child: Text(
buttonTitle,
style: kLargeButtonTextStyle,
),
),
color: kBottomContainerColour,
margin: EdgeInsets.only(top: 10.0),
padding: EdgeInsets.only(bottom: 20.0),
width: double.infinity,
height: kBottomContainerHeight,
return RaisedButton(
onPressed: onTap,
padding: EdgeInsets.symmetric(vertical: 14, horizontal: 26),
color: kBottomContainerColour,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(8))),
child: AutoSizeText(
buttonTitle,
style: kLargeButtonTextStyle,
),
);
}
Expand Down
9 changes: 7 additions & 2 deletions lib/components/icon_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ import 'package:flutter/material.dart';
import 'package:bmi_calculator/constants.dart';

class IconContent extends StatelessWidget {
IconContent({this.icon, this.label});
IconContent({this.selected, this.icon, this.label});

final bool selected;
final IconData icon;
final String label;

Expand All @@ -14,6 +15,7 @@ class IconContent extends StatelessWidget {
children: <Widget>[
Icon(
icon,
color: selected ? Theme.of(context).accentColor : Colors.white.withAlpha(125),
size: 80.0,
),
SizedBox(
Expand All @@ -22,7 +24,10 @@ class IconContent extends StatelessWidget {
Text(
label,
style: kLabelTextStyle,
)
),
SizedBox(
height: 5.0,
),
],
);
}
Expand Down
3 changes: 2 additions & 1 deletion lib/components/reusable_card.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:bmi_calculator/constants.dart';
import 'package:flutter/material.dart';

class ReusableCard extends StatelessWidget {
Expand All @@ -13,7 +14,7 @@ class ReusableCard extends StatelessWidget {
onTap: onPress,
child: Container(
child: cardChild,
margin: EdgeInsets.all(15.0),
margin: EdgeInsets.all(kMainMargin),
decoration: BoxDecoration(
color: colour,
borderRadius: BorderRadius.circular(10.0),
Expand Down
6 changes: 3 additions & 3 deletions lib/components/round_icon_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class RoundIconButton extends StatelessWidget {
elevation: 0.0,
child: Icon(icon),
onPressed: onPressed,
constraints: BoxConstraints.tightFor(
width: 56.0,
height: 56.0,
constraints: BoxConstraints(
minWidth: 36, minHeight: 36,
maxWidth: 56, maxHeight: 56,
),
shape: CircleBorder(),
fillColor: Color(0xFF4C4F5E),
Expand Down
8 changes: 5 additions & 3 deletions lib/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import 'package:flutter/material.dart';
const kBottomContainerHeight = 80.0;
const kActiveCardColour = Color(0xFF1D1E33);
const kInactiveCardColour = Color(0xFF111328);
const kBottomContainerColour = Color(0xFFEB1555);
const kBottomContainerColour = Colors.pink;

const kLabelTextStyle = TextStyle(
fontSize: 18.0,
color: Color(0xFF8D8E98),
);

const kNumberTextStyle = TextStyle(
fontSize: 50.0,
fontSize: 46.0,
fontWeight: FontWeight.w900,
);

Expand All @@ -27,7 +27,7 @@ const kTitleTextStyle = TextStyle(

const kResultTextStyle = TextStyle(
color: Color(0xFF24D876),
fontSize: 22.0,
fontSize: 26.0,
fontWeight: FontWeight.bold,
);

Expand All @@ -39,3 +39,5 @@ const kBMITextStyle = TextStyle(
const kBodyTextStyle = TextStyle(
fontSize: 22.0,
);

const kMainMargin = 16.0;
11 changes: 9 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
import 'package:flutter/material.dart';
import 'package:bmi_calculator/screens/input_page.dart';
import 'package:bmi_calculator/screens/results_page.dart';
import 'package:flutter/material.dart';

void main() => runApp(BMICalculator());

class BMICalculator extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
theme: ThemeData.dark().copyWith(
primaryColor: Color(0xFF0A0E21),
scaffoldBackgroundColor: Color(0xFF0A0E21),
accentColor: Colors.pink
),
home: InputPage(),
initialRoute: InputPage.route,
routes: {
InputPage.route: (ctx) => InputPage(),
ResultsPage.route: (ctx) => ResultsPage(),
}
);
}
}
Loading