Skip to content

Commit

Permalink
Compatibility updates for Flutter 2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
dgewe authored and ashwinkey04 committed Sep 19, 2021
1 parent 89d01f5 commit 5065ca4
Show file tree
Hide file tree
Showing 28 changed files with 429 additions and 153 deletions.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,11 @@ Flutter, Dart

## Setup

#### (IMPORTANT) Flutter SDK
* Tested and works with Flutter SDK version 1.22.4
* [Flutter SDK Releases](https://flutter.dev/docs/development/tools/sdk/releases)

#### Requirements
* Basic knowledge about Flutter
* Basic knowledge about Android
* Basic knowledge about Firebase
* Flutter SDK version >= 2.0.0 (tested and works with 2.0.0)

#### Firebase
* Setup Authentication and use the Sign-in method 'Email/Password'
Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.fredrikbogg.tinder_app_flutter"
applicationId "org.hackmit.wimpies"
minSdkVersion 21
targetSdkVersion 29
versionCode flutterVersionCode.toInteger()
Expand Down
40 changes: 39 additions & 1 deletion android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
replace this
{
"project_info": {
"project_number": "143882955394",
"project_id": "hackmit-d",
"storage_bucket": "hackmit-d.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:143882955394:android:342d82d30157c91e15229b",
"android_client_info": {
"package_name": "org.hackmit.wimpies"
}
},
"oauth_client": [
{
"client_id": "143882955394-23qid8tn1bv52me4l3op79khuqkg3r8d.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyCWPx06g_7jqNIznWXSMl0cyTq0WiuxLlI"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "143882955394-23qid8tn1bv52me4l3op79khuqkg3r8d.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
6 changes: 5 additions & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<application
android:name="io.flutter.app.FlutterApplication"
android:icon="@mipmap/ic_launcher"
android:label="Tinder App Flutter">
android:label="Wimpies">
<activity
android:name="com.fredrikbogg.tinder_app_flutter.MainActivity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
Expand Down Expand Up @@ -36,6 +36,10 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.yalantis.ucrop.UCropActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
Expand Down
Binary file added fonts/OpenSans-Bold.ttf
Binary file not shown.
Binary file added fonts/OpenSans-Italic.ttf
Binary file not shown.
Binary file added fonts/OpenSans-Light.ttf
Binary file not shown.
Binary file added fonts/OpenSans-Regular.ttf
Binary file not shown.
Binary file added images/makefg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>9.0</string>
</dict>
</plist>
1 change: 1 addition & 0 deletions ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
34 changes: 34 additions & 0 deletions ios/GoogleService-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CLIENT_ID</key>
<string>143882955394-ohahcno875vgp9tn0h26k4qbgderen8q.apps.googleusercontent.com</string>
<key>REVERSED_CLIENT_ID</key>
<string>com.googleusercontent.apps.143882955394-ohahcno875vgp9tn0h26k4qbgderen8q</string>
<key>API_KEY</key>
<string>AIzaSyDnKVlbw13mbMb1IsHzO-ZDsTEmFMK8D5g</string>
<key>GCM_SENDER_ID</key>
<string>143882955394</string>
<key>PLIST_VERSION</key>
<string>1</string>
<key>BUNDLE_ID</key>
<string>org.hackmit.wimpies</string>
<key>PROJECT_ID</key>
<string>hackmit-d</string>
<key>STORAGE_BUCKET</key>
<string>hackmit-d.appspot.com</string>
<key>IS_ADS_ENABLED</key>
<false></false>
<key>IS_ANALYTICS_ENABLED</key>
<false></false>
<key>IS_APPINVITE_ENABLED</key>
<true></true>
<key>IS_GCM_ENABLED</key>
<true></true>
<key>IS_SIGNIN_ENABLED</key>
<true></true>
<key>GOOGLE_APP_ID</key>
<string>1:143882955394:ios:be5c497c3847dcf215229b</string>
</dict>
</plist>
38 changes: 38 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
31 changes: 23 additions & 8 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 50;
objects = {

/* Begin PBXBuildFile section */
Expand All @@ -14,6 +14,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
CF1F090D26F49BB400CEB115 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = CF1F090C26F49BB400CEB115 /* GoogleService-Info.plist */; };
/* End PBXBuildFile section */

/* Begin PBXCopyFilesBuildPhase section */
Expand Down Expand Up @@ -44,6 +45,7 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
CF1F090C26F49BB400CEB115 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -71,10 +73,10 @@
97C146E51CF9000F007C117D = {
isa = PBXGroup;
children = (
CF1F090C26F49BB400CEB115 /* GoogleService-Info.plist */,
9740EEB11CF90186004384FC /* Flutter */,
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
);
sourceTree = "<group>";
};
Expand Down Expand Up @@ -172,6 +174,7 @@
files = (
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
CF1F090D26F49BB400CEB115 /* GoogleService-Info.plist in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
);
Expand Down Expand Up @@ -305,12 +308,16 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.fredrikbogg.tinderCloneFlutter;
PRODUCT_BUNDLE_IDENTIFIER = org.hackmit.wimpies;
PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down Expand Up @@ -433,12 +440,16 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.fredrikbogg.tinderCloneFlutter;
PRODUCT_BUNDLE_IDENTIFIER = org.hackmit.wimpies;
PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic";
};
Expand All @@ -456,12 +467,16 @@
"$(PROJECT_DIR)/Flutter",
);
INFOPLIST_FILE = Runner/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
PRODUCT_BUNDLE_IDENTIFIER = com.fredrikbogg.tinderCloneFlutter;
PRODUCT_BUNDLE_IDENTIFIER = org.hackmit.wimpies;
PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic";
};
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/ui/screens/login_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class _LoginScreenState extends State<LoginScreen> {
return SafeArea(
child: Scaffold(
key: _scaffoldKey,
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
appBar: AppBar(
title: Text('Login'),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/screens/register_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
resizeToAvoidBottomPadding: false,
resizeToAvoidBottomInset: false,
key: _scaffoldKey,
appBar: AppBar(title: Text('Register')),
body: CustomModalProgressHUD(
Expand Down
48 changes: 47 additions & 1 deletion lib/ui/screens/register_sub_screens/add_photo_screen.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:image_cropper/image_cropper.dart';
import 'package:image_picker/image_picker.dart';
import 'package:tinder_app_flutter/ui/widgets/rounded_icon_button.dart';
import 'package:tinder_app_flutter/ui/widgets/image_portrait.dart';
import 'package:tinder_app_flutter/util/constants.dart';

class AddPhotoScreen extends StatefulWidget {
final Function(String) onPhotoChanged;
Expand All @@ -15,11 +19,53 @@ class AddPhotoScreen extends StatefulWidget {
class _AddPhotoScreenState extends State<AddPhotoScreen> {
final picker = ImagePicker();
String _imagePath;
var _croppedImage;

Future pickImageFromGallery() async {
final pickedFile = await picker.getImage(source: ImageSource.gallery);

if (pickedFile != null) {
try {
_croppedImage = await ImageCropper.cropImage(
sourcePath: pickedFile.path,
aspectRatioPresets: Platform.isAndroid
? [
CropAspectRatioPreset.square,
CropAspectRatioPreset.ratio3x2,
CropAspectRatioPreset.original,
CropAspectRatioPreset.ratio4x3,
CropAspectRatioPreset.ratio16x9
]
: [
CropAspectRatioPreset.original,
CropAspectRatioPreset.square,
CropAspectRatioPreset.ratio3x2,
CropAspectRatioPreset.ratio4x3,
CropAspectRatioPreset.ratio5x3,
CropAspectRatioPreset.ratio5x4,
CropAspectRatioPreset.ratio7x5,
CropAspectRatioPreset.ratio16x9
],
androidUiSettings: AndroidUiSettings(
toolbarTitle: 'Crop',
toolbarColor: Colors.black87,
toolbarWidgetColor: Colors.white,
activeControlsWidgetColor: kAccentColor,
initAspectRatio: CropAspectRatioPreset.original,
lockAspectRatio: false),
iosUiSettings: IOSUiSettings(
title: 'Cropper',
));
} catch (_) {
print(_.toString());
}
if (_croppedImage != null) {
widget.onPhotoChanged(_croppedImage.path);

setState(() {
_imagePath = _croppedImage.path;
});
}
if (_croppedImage == null && pickedFile != null) {
widget.onPhotoChanged(pickedFile.path);

setState(() {
Expand Down
10 changes: 5 additions & 5 deletions lib/ui/screens/register_sub_screens/age_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AgeScreen extends StatefulWidget {
}

class _AgeScreenState extends State<AgeScreen> {
int age = 0;
int age = 13;

@override
Widget build(BuildContext context) {
Expand All @@ -38,14 +38,14 @@ class _AgeScreenState extends State<AgeScreen> {
Expanded(
child: Center(
child: Container(
child: NumberPicker.integer(
listViewWidth: double.infinity,
child: NumberPicker(
itemWidth: double.infinity,
decoration: BoxDecoration(
border: Border.all(color: Colors.white, width: 2),
borderRadius: BorderRadius.circular(10),
),
initialValue: age,
minValue: 0,
value: age,
minValue: 12,
maxValue: 120,
onChanged: (value) => {
setState(() {
Expand Down
Loading

0 comments on commit 5065ca4

Please sign in to comment.