From 3c8e147ee8929343d59cb2ef3003610e8f34f36f Mon Sep 17 00:00:00 2001 From: lancegin Date: Sat, 22 Sep 2018 23:18:10 +0800 Subject: [PATCH] upd: import dotp module --- lib/main.dart | 30 ++++++++++++------------------ pubspec.lock | 14 ++++++++++++++ pubspec.yaml | 1 + 3 files changed, 27 insertions(+), 18 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 5590a2a..16823d7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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()); @@ -24,7 +25,8 @@ class RandomWords extends StatefulWidget { class RandomWordsState extends State { final _suggestions = []; final _saved = new Set(); - 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( @@ -47,21 +49,16 @@ class RandomWordsState extends State { 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, ); } @@ -70,9 +67,6 @@ class RandomWordsState extends State { return new Scaffold( appBar: new AppBar( title: new Text('MinaOTP'), - actions: [ - new IconButton(icon: new Icon(Icons.list), onPressed: _pushSaved), - ], ), body: _buildSuggestions(), ); @@ -87,7 +81,7 @@ class RandomWordsState extends State { return new ListTile( title: new Text( pair.asPascalCase, - style: _biggerFont, + style: _titleFont, ), ); }, diff --git a/pubspec.lock b/pubspec.lock index 9886985..29aad5d 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -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: @@ -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: diff --git a/pubspec.yaml b/pubspec.yaml index 000fe78..922e19d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: