Skip to content

Commit

Permalink
Дороблено docs.flutter.dev/get-started/codelab
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar1ua committed Oct 11, 2022
1 parent 5cecafe commit 4f7cb6f
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icon/icon-android.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 37 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import 'package:english_words/english_words.dart';
import 'package:flutter/cupertino.dart';
import 'package:cupertino_list_tile/cupertino_list_tile.dart';

void main() {
runApp(const MyApp());
Expand All @@ -7,6 +9,8 @@ void main() {
class MyApp extends StatelessWidget {
const MyApp({super.key});

static const colorGreen = Color(0xff16a34a);

@override
Widget build(BuildContext context) {
return const CupertinoApp(
Expand All @@ -19,15 +23,46 @@ class MyApp extends StatelessWidget {
color: CupertinoColors.white,
),
),
backgroundColor: Color(0xff16a34a),
backgroundColor: colorGreen,
brightness: Brightness.dark,
),
child: SafeArea(
child: Center(
child: Text('Hello World'),
child: RandomWords(),
),
),
),
);
}
}

class _RandomWordsState extends State<RandomWords> {
final _suggestions = <WordPair>[];
final _biggerFont = const TextStyle(fontSize: 18);

@override
Widget build(BuildContext context) {
return ListView.builder(
padding: const EdgeInsets.all(16.0),
itemBuilder: (context, i) {
if (i >= _suggestions.length) {
_suggestions.addAll(generateWordPairs().take(10));
}
return CupertinoListTile(
title: Text(
_suggestions[i].asPascalCase,
style: _biggerFont,
),
trailing: const Text(''),
);
},
);
}
}

class RandomWords extends StatefulWidget {
const RandomWords({super.key});

@override
State<RandomWords> createState() => _RandomWordsState();
}
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.5"
cupertino_list_tile:
dependency: "direct main"
description:
name: cupertino_list_tile
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.1"
english_words:
dependency: "direct main"
description:
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
english_words: ^4.0.0
cupertino_list_tile: ^0.2.1

dev_dependencies:
flutter_test:
Expand All @@ -60,7 +61,7 @@ flutter_icons:
ios: true
remove_alpha_ios: true
adaptive_icon_background: '#16a34a'
adaptive_icon_foreground: 'icon/icon.png'
adaptive_icon_foreground: 'icon/icon-android.png'

# The following section is specific to Flutter packages.
flutter:
Expand Down

0 comments on commit 4f7cb6f

Please sign in to comment.