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:
@@ -14,7 +14,7 @@ match any new language/SDK features, etc.).
|
|||||||
| jsonexample | | |
|
| jsonexample | | |
|
||||||
| material_studies/shrine | | |
|
| material_studies/shrine | | |
|
||||||
| place_tracker | | |
|
| place_tracker | | |
|
||||||
| platform_design | | |
|
| platform_design | johnpryan | 10/7/19 |
|
||||||
| platform_view_swift | | |
|
| platform_view_swift | | |
|
||||||
| provider_counter | | |
|
| provider_counter | | |
|
||||||
| provider_shopper | | |
|
| provider_shopper | | |
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
include: package:pedantic/analysis_options.1.7.0.yaml
|
include: package:pedantic/analysis_options.1.8.0.yaml
|
||||||
|
|
||||||
analyzer:
|
analyzer:
|
||||||
strong-mode:
|
strong-mode:
|
||||||
|
|||||||
@@ -32,7 +32,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
|
||||||
applicationId "com.example.platform_design"
|
applicationId "com.example.platform_design"
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
@@ -43,8 +42,6 @@ android {
|
|||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
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
|
signingConfig signingConfigs.debug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
|
||||||
|
|
||||||
import 'songs_tab.dart';
|
import 'songs_tab.dart';
|
||||||
import 'news_tab.dart';
|
import 'news_tab.dart';
|
||||||
@@ -13,8 +12,6 @@ void main() => runApp(MyAdaptingApp());
|
|||||||
class MyAdaptingApp extends StatelessWidget {
|
class MyAdaptingApp extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(context) {
|
Widget build(context) {
|
||||||
// Change this value to better see animations.
|
|
||||||
timeDilation = 1;
|
|
||||||
// Either Material or Cupertino widgets work in either Material or Cupertino
|
// Either Material or Cupertino widgets work in either Material or Cupertino
|
||||||
// Apps.
|
// Apps.
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
@@ -52,7 +49,7 @@ class PlatformAdaptingHomePage extends StatefulWidget {
|
|||||||
|
|
||||||
class _PlatformAdaptingHomePageState extends State<PlatformAdaptingHomePage> {
|
class _PlatformAdaptingHomePageState extends State<PlatformAdaptingHomePage> {
|
||||||
// This app keeps a global key for the songs tab because it owns a bunch of
|
// 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
|
// scaffolds, keeping a global key to it lets this app keep that tab's data as
|
||||||
// the platform toggles.
|
// the platform toggles.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
import 'widgets.dart';
|
import 'widgets.dart';
|
||||||
|
|
||||||
// Page shown when a card in the songs tab is tapped.
|
/// 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
|
/// 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.
|
/// top of the songs tab's content but is below the tab bar itself.
|
||||||
class SongDetailTab extends StatelessWidget {
|
class SongDetailTab extends StatelessWidget {
|
||||||
const SongDetailTab({this.id, this.song, this.color});
|
const SongDetailTab({this.id, this.song, this.color});
|
||||||
|
|
||||||
|
|||||||
@@ -139,9 +139,7 @@ class _SongsTabState extends State<SongsTab> {
|
|||||||
CupertinoSliverNavigationBar(
|
CupertinoSliverNavigationBar(
|
||||||
trailing: CupertinoButton(
|
trailing: CupertinoButton(
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
// TODO(redbrogdon): Change this back to shuffle once the new icon
|
child: Icon(CupertinoIcons.shuffle),
|
||||||
// makes it into Flutter's stable channel.
|
|
||||||
child: Icon(CupertinoIcons.shuffle_thick),
|
|
||||||
onPressed: _togglePlatform,
|
onPressed: _togglePlatform,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
import 'dart:math';
|
import 'dart:math';
|
||||||
|
|
||||||
import 'package:english_words/english_words.dart';
|
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
|
// ignore: implementation_imports
|
||||||
import 'package:english_words/src/words/unsafe.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
// This file has a number of platform-agnostic non-Widget utility functions.
|
// This file has a number of platform-agnostic non-Widget utility functions.
|
||||||
@@ -26,26 +22,9 @@ const _myListOfRandomColors = [
|
|||||||
|
|
||||||
final _random = Random();
|
final _random = Random();
|
||||||
|
|
||||||
final wordPairIterator = generateWordPair();
|
// Avoid customizing the word generator, which can be slow.
|
||||||
Iterable<WordPair> generateWordPair() sync* {
|
// https://github.com/filiph/english_words/issues/9
|
||||||
bool filterWord(String word) => unsafe.contains(word);
|
final wordPairIterator = generateWordPairs();
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String generateRandomHeadline() {
|
String generateRandomHeadline() {
|
||||||
final artist = capitalizePair(wordPairIterator.first);
|
final artist = capitalizePair(wordPairIterator.first);
|
||||||
|
|||||||
@@ -158,4 +158,3 @@ packages:
|
|||||||
version: "2.0.8"
|
version: "2.0.8"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.5.0 <3.0.0"
|
dart: ">=2.5.0 <3.0.0"
|
||||||
flutter: ">=1.5.2"
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ version: 1.0.0+1
|
|||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.5.0 <3.0.0"
|
sdk: ">=2.5.0 <3.0.0"
|
||||||
flutter: ">=1.5.2"
|
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
english_words: ^3.1.5
|
english_words: ^3.1.5
|
||||||
@@ -17,7 +16,7 @@ dependencies:
|
|||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
pedantic: ^1.7.0
|
pedantic: ^1.8.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
|
|||||||
Reference in New Issue
Block a user