mirror of
https://github.com/flutter/samples.git
synced 2025-11-08 13:58:47 +00:00
platform_design maintenance (#149)
* platform_design maintenance * update maintenance table
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
include: package:pedantic/analysis_options.1.7.0.yaml
|
||||
include: package:pedantic/analysis_options.1.8.0.yaml
|
||||
|
||||
analyzer:
|
||||
strong-mode:
|
||||
|
||||
@@ -32,7 +32,6 @@ android {
|
||||
}
|
||||
|
||||
defaultConfig {
|
||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
||||
applicationId "com.example.platform_design"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 28
|
||||
@@ -43,8 +42,6 @@ android {
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
// TODO: Add your own signing config for the release build.
|
||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
||||
signingConfig signingConfigs.debug
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
|
||||
import 'songs_tab.dart';
|
||||
import 'news_tab.dart';
|
||||
@@ -13,8 +12,6 @@ void main() => runApp(MyAdaptingApp());
|
||||
class MyAdaptingApp extends StatelessWidget {
|
||||
@override
|
||||
Widget build(context) {
|
||||
// Change this value to better see animations.
|
||||
timeDilation = 1;
|
||||
// Either Material or Cupertino widgets work in either Material or Cupertino
|
||||
// Apps.
|
||||
return MaterialApp(
|
||||
@@ -52,7 +49,7 @@ class PlatformAdaptingHomePage extends StatefulWidget {
|
||||
|
||||
class _PlatformAdaptingHomePageState extends State<PlatformAdaptingHomePage> {
|
||||
// This app keeps a global key for the songs tab because it owns a bunch of
|
||||
// data. Since changing platform reparents those tabs into different
|
||||
// data. Since changing platform re-parents those tabs into different
|
||||
// scaffolds, keeping a global key to it lets this app keep that tab's data as
|
||||
// the platform toggles.
|
||||
//
|
||||
|
||||
@@ -3,10 +3,10 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'widgets.dart';
|
||||
|
||||
// Page shown when a card in the songs tab is tapped.
|
||||
//
|
||||
// On Android, this page sits at the top of your app. On iOS, this page is on
|
||||
// top of the songs tab's content but is below the tab bar itself.
|
||||
/// Page shown when a card in the songs tab is tapped.
|
||||
///
|
||||
/// On Android, this page sits at the top of your app. On iOS, this page is on
|
||||
/// top of the songs tab's content but is below the tab bar itself.
|
||||
class SongDetailTab extends StatelessWidget {
|
||||
const SongDetailTab({this.id, this.song, this.color});
|
||||
|
||||
|
||||
@@ -139,9 +139,7 @@ class _SongsTabState extends State<SongsTab> {
|
||||
CupertinoSliverNavigationBar(
|
||||
trailing: CupertinoButton(
|
||||
padding: EdgeInsets.zero,
|
||||
// TODO(redbrogdon): Change this back to shuffle once the new icon
|
||||
// makes it into Flutter's stable channel.
|
||||
child: Icon(CupertinoIcons.shuffle_thick),
|
||||
child: Icon(CupertinoIcons.shuffle),
|
||||
onPressed: _togglePlatform,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:english_words/english_words.dart';
|
||||
// This reimplements generateWordPair because english_words's
|
||||
// implementation has some performance issues.
|
||||
// https://github.com/filiph/english_words/issues/9
|
||||
// ignore: implementation_imports
|
||||
import 'package:english_words/src/words/unsafe.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// This file has a number of platform-agnostic non-Widget utility functions.
|
||||
@@ -26,26 +22,9 @@ const _myListOfRandomColors = [
|
||||
|
||||
final _random = Random();
|
||||
|
||||
final wordPairIterator = generateWordPair();
|
||||
Iterable<WordPair> generateWordPair() sync* {
|
||||
bool filterWord(String word) => unsafe.contains(word);
|
||||
String pickRandom(List<String> list) => list[_random.nextInt(list.length)];
|
||||
|
||||
String prefix;
|
||||
while (true) {
|
||||
if (_random.nextBool()) {
|
||||
prefix = pickRandom(adjectives);
|
||||
} else {
|
||||
prefix = pickRandom(nouns);
|
||||
}
|
||||
final suffix = pickRandom(nouns);
|
||||
|
||||
if (filterWord(prefix) || filterWord(suffix)) continue;
|
||||
|
||||
final wordPair = WordPair(prefix, suffix);
|
||||
yield wordPair;
|
||||
}
|
||||
}
|
||||
// Avoid customizing the word generator, which can be slow.
|
||||
// https://github.com/filiph/english_words/issues/9
|
||||
final wordPairIterator = generateWordPairs();
|
||||
|
||||
String generateRandomHeadline() {
|
||||
final artist = capitalizePair(wordPairIterator.first);
|
||||
|
||||
@@ -158,4 +158,3 @@ packages:
|
||||
version: "2.0.8"
|
||||
sdks:
|
||||
dart: ">=2.5.0 <3.0.0"
|
||||
flutter: ">=1.5.2"
|
||||
|
||||
@@ -4,7 +4,6 @@ version: 1.0.0+1
|
||||
|
||||
environment:
|
||||
sdk: ">=2.5.0 <3.0.0"
|
||||
flutter: ">=1.5.2"
|
||||
|
||||
dependencies:
|
||||
english_words: ^3.1.5
|
||||
@@ -17,7 +16,7 @@ dependencies:
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
pedantic: ^1.7.0
|
||||
pedantic: ^1.8.0
|
||||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
Reference in New Issue
Block a user