Skip to content

Commit 06d89de

Browse files
committed
Added 039 code and entry into readme
1 parent 69eef4d commit 06d89de

File tree

101 files changed

+3030
-13
lines changed

Some content is hidden

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

101 files changed

+3030
-13
lines changed

038-firebase-authentication/01-final/lib/ui/views/home_view.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ class HomeView extends StatelessWidget {
55

66
@override
77
Widget build(BuildContext context) {
8-
return Center(
9-
child: Text('Home'),
8+
return Scaffold(
9+
body: Center(
10+
child: Text('Home'),
11+
),
1012
);
1113
}
1214
}
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
import 'package:flutter/material.dart';
2+
import 'package:compound/ui/shared/shared_styles.dart' as sharedStyles;
3+
4+
class ExpansionList<T> extends StatefulWidget {
5+
final List<T> items;
6+
final String title;
7+
final Function(T) onItemSelected;
8+
final bool smallVersion;
9+
ExpansionList({
10+
Key key,
11+
this.items,
12+
this.title,
13+
@required this.onItemSelected,
14+
this.smallVersion = false,
15+
}) : super(key: key);
16+
17+
_ExpansionListState createState() => _ExpansionListState();
18+
}
19+
20+
class _ExpansionListState extends State<ExpansionList> {
21+
final double startingHeight = sharedStyles.fieldHeight;
22+
double expandedHeight;
23+
bool expanded = false;
24+
String selectedValue;
25+
26+
@override
27+
void initState() {
28+
super.initState();
29+
selectedValue = widget.title;
30+
_calculateExpandedHeight();
31+
}
32+
33+
@override
34+
Widget build(BuildContext context) {
35+
return AnimatedContainer(
36+
padding: sharedStyles.fieldPadding,
37+
duration: const Duration(milliseconds: 180),
38+
height: expanded
39+
? expandedHeight
40+
: widget.smallVersion
41+
? sharedStyles.smallFieldHeight
42+
: startingHeight,
43+
decoration: sharedStyles.fieldDecortaion.copyWith(
44+
boxShadow: expanded
45+
? [BoxShadow(blurRadius: 10, color: Colors.grey[300])]
46+
: null,
47+
),
48+
child: ListView(
49+
physics: NeverScrollableScrollPhysics(),
50+
padding: const EdgeInsets.all(0),
51+
children: <Widget>[
52+
ExpansionListItem(
53+
title: selectedValue,
54+
onTap: () {
55+
setState(() {
56+
expanded = !expanded;
57+
});
58+
},
59+
showArrow: true,
60+
smallVersion: widget.smallVersion,
61+
),
62+
Container(
63+
height: 2,
64+
color: Colors.grey[300],
65+
),
66+
..._getDropdownListItems()
67+
],
68+
),
69+
);
70+
}
71+
72+
List<Widget> _getDropdownListItems() {
73+
return widget.items
74+
.map((item) => ExpansionListItem(
75+
smallVersion: widget.smallVersion,
76+
title: item.toString(),
77+
onTap: () {
78+
setState(() {
79+
expanded = !expanded;
80+
selectedValue = item.toString();
81+
});
82+
83+
widget.onItemSelected(item);
84+
}))
85+
.toList();
86+
}
87+
88+
void _calculateExpandedHeight() {
89+
expandedHeight = 2 +
90+
(widget.smallVersion
91+
? sharedStyles.smallFieldHeight
92+
: sharedStyles.fieldHeight) +
93+
(widget.items.length *
94+
(widget.smallVersion
95+
? sharedStyles.smallFieldHeight
96+
: sharedStyles.fieldHeight));
97+
}
98+
}
99+
100+
class ExpansionListItem extends StatelessWidget {
101+
final Function onTap;
102+
final String title;
103+
final bool showArrow;
104+
final bool smallVersion;
105+
const ExpansionListItem({
106+
Key key,
107+
this.onTap,
108+
this.title,
109+
this.showArrow = false,
110+
this.smallVersion = false,
111+
}) : super(key: key);
112+
113+
@override
114+
Widget build(BuildContext context) {
115+
return GestureDetector(
116+
behavior: HitTestBehavior.opaque,
117+
onTap: onTap,
118+
child: Container(
119+
height: smallVersion
120+
? sharedStyles.smallFieldHeight
121+
: sharedStyles.fieldHeight,
122+
alignment: Alignment.centerLeft,
123+
child: Row(
124+
mainAxisSize: MainAxisSize.max,
125+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
126+
children: <Widget>[
127+
Expanded(
128+
child: Text(
129+
title ?? '',
130+
style: Theme.of(context)
131+
.textTheme
132+
.subhead
133+
.copyWith(fontSize: smallVersion ? 12 : 15),
134+
),
135+
),
136+
showArrow
137+
? Icon(
138+
Icons.arrow_drop_down,
139+
color: Colors.grey[700],
140+
size: 20,
141+
)
142+
: Container()
143+
],
144+
),
145+
),
146+
);
147+
}
148+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"_info":"// This is a generated file; do not edit or check into version control.","dependencyGraph":[{"name":"cloud_firestore","dependencies":["firebase_core"]},{"name":"firebase_auth","dependencies":["firebase_core","firebase_auth_web"]},{"name":"firebase_auth_web","dependencies":[]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]}]}
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.buildlog/
9+
.history
10+
.svn/
11+
12+
# IntelliJ related
13+
*.iml
14+
*.ipr
15+
*.iws
16+
.idea/
17+
18+
# Visual Studio Code related
19+
.vscode/
20+
21+
# Flutter/Dart/Pub related
22+
**/doc/api/
23+
.dart_tool/
24+
.flutter-plugins
25+
.packages
26+
.pub-cache/
27+
.pub/
28+
/build/
29+
30+
# Android related
31+
**/android/**/gradle-wrapper.jar
32+
**/android/.gradle
33+
**/android/captures/
34+
**/android/gradlew
35+
**/android/gradlew.bat
36+
**/android/local.properties
37+
**/android/**/GeneratedPluginRegistrant.java
38+
39+
# iOS/XCode related
40+
**/ios/**/*.mode1v3
41+
**/ios/**/*.mode2v3
42+
**/ios/**/*.moved-aside
43+
**/ios/**/*.pbxuser
44+
**/ios/**/*.perspectivev3
45+
**/ios/**/*sync/
46+
**/ios/**/.sconsign.dblite
47+
**/ios/**/.tags*
48+
**/ios/**/.vagrant/
49+
**/ios/**/DerivedData/
50+
**/ios/**/Icon?
51+
**/ios/**/Pods/
52+
**/ios/**/.symlinks/
53+
**/ios/**/profile
54+
**/ios/**/xcuserdata
55+
**/ios/.generated/
56+
**/ios/Flutter/App.framework
57+
**/ios/Flutter/Flutter.framework
58+
**/ios/Flutter/Generated.xcconfig
59+
**/ios/Flutter/app.flx
60+
**/ios/Flutter/app.zip
61+
**/ios/Flutter/flutter_assets/
62+
**/ios/ServiceDefinitions.json
63+
**/ios/Runner/GeneratedPluginRegistrant.*
64+
65+
# Exceptions to above rules.
66+
!**/ios/**/default.mode1v3
67+
!**/ios/**/default.mode2v3
68+
!**/ios/**/default.pbxuser
69+
!**/ios/**/default.perspectivev3
70+
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This file tracks properties of this Flutter project.
2+
# Used by Flutter tool to assess capabilities and perform upgrades etc.
3+
#
4+
# This file should be version controlled and should not be manually edited.
5+
6+
version:
7+
revision: 740fb2a8bb6d43a475ce76f7fe3e5fc10bbe24ff
8+
channel: master
9+
10+
project_type: app

039-firebase-custom-start-user-profile/README.md

Whitespace-only changes.
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
def localProperties = new Properties()
2+
def localPropertiesFile = rootProject.file('local.properties')
3+
if (localPropertiesFile.exists()) {
4+
localPropertiesFile.withReader('UTF-8') { reader ->
5+
localProperties.load(reader)
6+
}
7+
}
8+
9+
def flutterRoot = localProperties.getProperty('flutter.sdk')
10+
if (flutterRoot == null) {
11+
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12+
}
13+
14+
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
15+
if (flutterVersionCode == null) {
16+
flutterVersionCode = '1'
17+
}
18+
19+
def flutterVersionName = localProperties.getProperty('flutter.versionName')
20+
if (flutterVersionName == null) {
21+
flutterVersionName = '1.0'
22+
}
23+
24+
apply plugin: 'com.android.application'
25+
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26+
27+
android {
28+
compileSdkVersion 28
29+
30+
lintOptions {
31+
disable 'InvalidPackage'
32+
}
33+
34+
defaultConfig {
35+
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
36+
applicationId "com.filledstacks.compound"
37+
minSdkVersion 21
38+
targetSdkVersion 28
39+
versionCode flutterVersionCode.toInteger()
40+
versionName flutterVersionName
41+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
42+
}
43+
44+
buildTypes {
45+
release {
46+
// TODO: Add your own signing config for the release build.
47+
// Signing with the debug keys for now, so `flutter run --release` works.
48+
signingConfig signingConfigs.debug
49+
}
50+
}
51+
}
52+
53+
flutter {
54+
source '../..'
55+
}
56+
57+
dependencies {
58+
testImplementation 'junit:junit:4.12'
59+
androidTestImplementation 'androidx.test:runner:1.1.1'
60+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
61+
}
62+
63+
apply plugin: 'com.google.gms.google-services'
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"project_info": {
3+
"project_number": "331279878066",
4+
"firebase_url": "https://compound-53007.firebaseio.com",
5+
"project_id": "compound-53007",
6+
"storage_bucket": "compound-53007.appspot.com"
7+
},
8+
"client": [
9+
{
10+
"client_info": {
11+
"mobilesdk_app_id": "1:331279878066:android:1ef0f6db1c2863bf8086ab",
12+
"android_client_info": {
13+
"package_name": "com.filledstacks.compound"
14+
}
15+
},
16+
"oauth_client": [
17+
{
18+
"client_id": "331279878066-bvogemandlhf398c0bev59b4rtkq3c7k.apps.googleusercontent.com",
19+
"client_type": 3
20+
}
21+
],
22+
"api_key": [
23+
{
24+
"current_key": "AIzaSyBxJVZjb_x3e9kJTM4x1i48rDOogJ6ISfk"
25+
}
26+
],
27+
"services": {
28+
"appinvite_service": {
29+
"other_platform_oauth_client": [
30+
{
31+
"client_id": "331279878066-bvogemandlhf398c0bev59b4rtkq3c7k.apps.googleusercontent.com",
32+
"client_type": 3
33+
}
34+
]
35+
}
36+
}
37+
}
38+
],
39+
"configuration_version": "1"
40+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.filledstacks.compound">
3+
<!-- Flutter needs it to communicate with the running application
4+
to allow setting breakpoints, to provide hot reload, etc.
5+
-->
6+
<uses-permission android:name="android.permission.INTERNET"/>
7+
</manifest>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2+
package="com.filledstacks.compound">
3+
4+
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
5+
calls FlutterMain.startInitialization(this); in its onCreate method.
6+
In most cases you can leave this as-is, but you if you want to provide
7+
additional functionality it is fine to subclass or reimplement
8+
FlutterApplication and put your custom class here. -->
9+
<application
10+
android:name="io.flutter.app.FlutterApplication"
11+
android:label="Compound"
12+
android:icon="@mipmap/ic_launcher">
13+
<activity
14+
android:name=".MainActivity"
15+
android:launchMode="singleTop"
16+
android:theme="@style/LaunchTheme"
17+
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
18+
android:hardwareAccelerated="true"
19+
android:windowSoftInputMode="adjustResize">
20+
<!-- This keeps the window background of the activity showing
21+
until Flutter renders its first frame. It can be removed if
22+
there is no splash screen (such as the default splash screen
23+
defined in @style/LaunchTheme). -->
24+
<meta-data
25+
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
26+
android:value="true" />
27+
<intent-filter>
28+
<action android:name="android.intent.action.MAIN"/>
29+
<category android:name="android.intent.category.LAUNCHER"/>
30+
</intent-filter>
31+
</activity>
32+
</application>
33+
</manifest>

0 commit comments

Comments
 (0)