Skip to content

Commit cc703b0

Browse files
firebase-get-to-know-flutter: separate main.dart into different files (flutter#1206)
* step 02: separate classes * step 04: separate classes * Step 05: separate classes * format step 02 * step 06: separate classes * Step 07: separate classes * step 09: separate classes * add license headers
1 parent 297acc4 commit cc703b0

40 files changed

Lines changed: 1121 additions & 868 deletions
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2022 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter/material.dart';
6+
7+
import 'src/widgets.dart';
8+
9+
class HomePage extends StatelessWidget {
10+
const HomePage({super.key});
11+
12+
@override
13+
Widget build(BuildContext context) {
14+
return Scaffold(
15+
appBar: AppBar(
16+
title: const Text('Firebase Meetup'),
17+
),
18+
body: ListView(
19+
children: <Widget>[
20+
Image.asset('assets/codelab.png'),
21+
const SizedBox(height: 8),
22+
const IconAndDetail(Icons.calendar_today, 'October 30'),
23+
const IconAndDetail(Icons.location_city, 'San Francisco'),
24+
const Divider(
25+
height: 8,
26+
thickness: 1,
27+
indent: 8,
28+
endIndent: 8,
29+
color: Colors.grey,
30+
),
31+
const Header("What we'll be doing"),
32+
const Paragraph(
33+
'Join us for a day full of Firebase Workshops and Pizza!',
34+
),
35+
],
36+
),
37+
);
38+
}
39+
}
Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
// Copyright 2022 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
import 'package:flutter/material.dart';
26
import 'package:google_fonts/google_fonts.dart';
37

4-
import 'src/widgets.dart';
8+
import 'home_page.dart';
59

610
void main() {
711
runApp(const App());
@@ -28,35 +32,3 @@ class App extends StatelessWidget {
2832
);
2933
}
3034
}
31-
32-
class HomePage extends StatelessWidget {
33-
const HomePage({super.key});
34-
35-
@override
36-
Widget build(BuildContext context) {
37-
return Scaffold(
38-
appBar: AppBar(
39-
title: const Text('Firebase Meetup'),
40-
),
41-
body: ListView(
42-
children: <Widget>[
43-
Image.asset('assets/codelab.png'),
44-
const SizedBox(height: 8),
45-
const IconAndDetail(Icons.calendar_today, 'October 30'),
46-
const IconAndDetail(Icons.location_city, 'San Francisco'),
47-
const Divider(
48-
height: 8,
49-
thickness: 1,
50-
indent: 8,
51-
endIndent: 8,
52-
color: Colors.grey,
53-
),
54-
const Header("What we'll be doing"),
55-
const Paragraph(
56-
'Join us for a day full of Firebase Workshops and Pizza!',
57-
),
58-
],
59-
),
60-
);
61-
}
62-
}

firebase-get-to-know-flutter/step_02/lib/src/authentication.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
import 'package:flutter/material.dart';
26

37
import 'widgets.dart';

firebase-get-to-know-flutter/step_02/lib/src/widgets.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
import 'package:flutter/material.dart';
26

37
class Header extends StatelessWidget {

firebase-get-to-know-flutter/step_02/test/widget_test.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
import 'package:flutter_test/flutter_test.dart';
26
import 'package:gtk_flutter/main.dart';
37

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Copyright 2022 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
import 'package:flutter/material.dart';
6+
7+
import 'src/widgets.dart';
8+
9+
class HomePage extends StatelessWidget {
10+
const HomePage({super.key});
11+
12+
@override
13+
Widget build(BuildContext context) {
14+
return Scaffold(
15+
appBar: AppBar(
16+
title: const Text('Firebase Meetup'),
17+
),
18+
body: ListView(
19+
children: <Widget>[
20+
Image.asset('assets/codelab.png'),
21+
const SizedBox(height: 8),
22+
const IconAndDetail(Icons.calendar_today, 'October 30'),
23+
const IconAndDetail(Icons.location_city, 'San Francisco'),
24+
const Divider(
25+
height: 8,
26+
thickness: 1,
27+
indent: 8,
28+
endIndent: 8,
29+
color: Colors.grey,
30+
),
31+
const Header("What we'll be doing"),
32+
const Paragraph(
33+
'Join us for a day full of Firebase Workshops and Pizza!',
34+
),
35+
],
36+
),
37+
);
38+
}
39+
}
Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
// Copyright 2022 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
import 'package:flutter/material.dart';
26
import 'package:google_fonts/google_fonts.dart';
37

4-
import 'src/widgets.dart';
8+
import 'home_page.dart';
59

610
void main() {
711
runApp(const App());
@@ -28,35 +32,3 @@ class App extends StatelessWidget {
2832
);
2933
}
3034
}
31-
32-
class HomePage extends StatelessWidget {
33-
const HomePage({super.key});
34-
35-
@override
36-
Widget build(BuildContext context) {
37-
return Scaffold(
38-
appBar: AppBar(
39-
title: const Text('Firebase Meetup'),
40-
),
41-
body: ListView(
42-
children: <Widget>[
43-
Image.asset('assets/codelab.png'),
44-
const SizedBox(height: 8),
45-
const IconAndDetail(Icons.calendar_today, 'October 30'),
46-
const IconAndDetail(Icons.location_city, 'San Francisco'),
47-
const Divider(
48-
height: 8,
49-
thickness: 1,
50-
indent: 8,
51-
endIndent: 8,
52-
color: Colors.grey,
53-
),
54-
const Header("What we'll be doing"),
55-
const Paragraph(
56-
'Join us for a day full of Firebase Workshops and Pizza!',
57-
),
58-
],
59-
),
60-
);
61-
}
62-
}

firebase-get-to-know-flutter/step_04/lib/src/authentication.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
import 'package:flutter/material.dart';
26

37
import 'widgets.dart';

firebase-get-to-know-flutter/step_04/lib/src/widgets.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
import 'package:flutter/material.dart';
26

37
class Header extends StatelessWidget {

firebase-get-to-know-flutter/step_04/test/widget_test.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
// Copyright 2022 The Flutter Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
15
import 'package:flutter_test/flutter_test.dart';
26
import 'package:gtk_flutter/main.dart';
37

0 commit comments

Comments
 (0)