Skip to content

Commit

Permalink
upd: import dotp module
Browse files Browse the repository at this point in the history
  • Loading branch information
LanceGin committed Sep 22, 2018
1 parent f33718c commit 3c8e147
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 18 deletions.
30 changes: 12 additions & 18 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:english_words/english_words.dart';
import 'package:dotp/dotp.dart';

void main() => runApp(new MinaOTP());

Expand All @@ -24,7 +25,8 @@ class RandomWords extends StatefulWidget {
class RandomWordsState extends State<RandomWords> {
final _suggestions = <WordPair>[];
final _saved = new Set<WordPair>();
final _biggerFont = const TextStyle(fontSize: 18.0);
final _titleFont = const TextStyle(fontSize: 18.0);
final _codeFont = const TextStyle(fontSize: 24.0);

Widget _buildSuggestions() {
return new ListView.builder(
Expand All @@ -47,21 +49,16 @@ class RandomWordsState extends State<RandomWords> {
return new ListTile(
title: new Text(
pair.asPascalCase,
style: _biggerFont,
style: _titleFont,
),
trailing: new Icon(
alreadySaved ? Icons.favorite : Icons.favorite_border,
color: alreadySaved ? Colors.red : null,
subtitle: new Text(
pair.asLowerCase,
),
onTap: () {
setState(() {
if (alreadySaved) {
_saved.remove(pair);
} else {
_saved.add(pair);
}
});
},
trailing: new Text(
'201826',
style: _codeFont,
),
onTap: _pushSaved,
);
}

Expand All @@ -70,9 +67,6 @@ class RandomWordsState extends State<RandomWords> {
return new Scaffold(
appBar: new AppBar(
title: new Text('MinaOTP'),
actions: <Widget>[
new IconButton(icon: new Icon(Icons.list), onPressed: _pushSaved),
],
),
body: _buildSuggestions(),
);
Expand All @@ -87,7 +81,7 @@ class RandomWordsState extends State<RandomWords> {
return new ListTile(
title: new Text(
pair.asPascalCase,
style: _biggerFont,
style: _titleFont,
),
);
},
Expand Down
14 changes: 14 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.8"
base32:
dependency: transitive
description:
name: base32
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.1"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -71,6 +78,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.2"
dotp:
dependency: "direct main"
description:
name: dotp
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.2"
english_words:
dependency: "direct main"
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
english_words: ^3.1.0
dotp: ^1.0.2

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 3c8e147

Please sign in to comment.