From 575845d4fe481f14b520e0823f1870a4a65706c7 Mon Sep 17 00:00:00 2001 From: rami-a <2364772+rami-a@users.noreply.github.com> Date: Fri, 10 Jan 2020 15:42:33 -0500 Subject: [PATCH] Cupertino textfield demo (#225) --- .../gallery/lib/codeviewer/code_segments.dart | 346 ++++++++++++++++++ gallery/gallery/lib/data/demos.dart | 16 + .../cupertino/cupertino_text_field_demo.dart | 66 ++++ .../lib/l10n/gallery_localizations.dart | 39 +- gallery/gallery/lib/l10n/intl_en_US.arb | 26 +- gallery/gallery/lib/l10n/intl_en_US.xml | 22 +- gallery/gallery/lib/l10n/messages_af.dart | 2 - gallery/gallery/lib/l10n/messages_am.dart | 2 - gallery/gallery/lib/l10n/messages_ar.dart | 2 - gallery/gallery/lib/l10n/messages_ar_EG.dart | 2 - gallery/gallery/lib/l10n/messages_ar_JO.dart | 2 - gallery/gallery/lib/l10n/messages_ar_MA.dart | 2 - gallery/gallery/lib/l10n/messages_ar_SA.dart | 2 - gallery/gallery/lib/l10n/messages_as.dart | 2 - gallery/gallery/lib/l10n/messages_az.dart | 2 - gallery/gallery/lib/l10n/messages_be.dart | 2 - gallery/gallery/lib/l10n/messages_bg.dart | 2 - gallery/gallery/lib/l10n/messages_bn.dart | 2 - gallery/gallery/lib/l10n/messages_bs.dart | 2 - gallery/gallery/lib/l10n/messages_ca.dart | 2 - gallery/gallery/lib/l10n/messages_cs.dart | 2 - gallery/gallery/lib/l10n/messages_da.dart | 2 - gallery/gallery/lib/l10n/messages_de.dart | 2 - gallery/gallery/lib/l10n/messages_de_AT.dart | 2 - gallery/gallery/lib/l10n/messages_de_CH.dart | 2 - gallery/gallery/lib/l10n/messages_el.dart | 2 - gallery/gallery/lib/l10n/messages_en_AU.dart | 2 - gallery/gallery/lib/l10n/messages_en_CA.dart | 2 - gallery/gallery/lib/l10n/messages_en_GB.dart | 2 - gallery/gallery/lib/l10n/messages_en_IE.dart | 2 - gallery/gallery/lib/l10n/messages_en_IN.dart | 2 - gallery/gallery/lib/l10n/messages_en_NZ.dart | 2 - gallery/gallery/lib/l10n/messages_en_SG.dart | 2 - gallery/gallery/lib/l10n/messages_en_US.dart | 12 +- gallery/gallery/lib/l10n/messages_en_ZA.dart | 2 - gallery/gallery/lib/l10n/messages_es.dart | 2 - gallery/gallery/lib/l10n/messages_es_419.dart | 2 - gallery/gallery/lib/l10n/messages_es_AR.dart | 2 - gallery/gallery/lib/l10n/messages_es_BO.dart | 2 - gallery/gallery/lib/l10n/messages_es_CL.dart | 2 - gallery/gallery/lib/l10n/messages_es_CO.dart | 2 - gallery/gallery/lib/l10n/messages_es_CR.dart | 2 - gallery/gallery/lib/l10n/messages_es_DO.dart | 2 - gallery/gallery/lib/l10n/messages_es_EC.dart | 2 - gallery/gallery/lib/l10n/messages_es_GT.dart | 2 - gallery/gallery/lib/l10n/messages_es_HN.dart | 2 - gallery/gallery/lib/l10n/messages_es_MX.dart | 2 - gallery/gallery/lib/l10n/messages_es_NI.dart | 2 - gallery/gallery/lib/l10n/messages_es_PA.dart | 2 - gallery/gallery/lib/l10n/messages_es_PE.dart | 2 - gallery/gallery/lib/l10n/messages_es_PR.dart | 2 - gallery/gallery/lib/l10n/messages_es_PY.dart | 2 - gallery/gallery/lib/l10n/messages_es_SV.dart | 2 - gallery/gallery/lib/l10n/messages_es_US.dart | 2 - gallery/gallery/lib/l10n/messages_es_UY.dart | 2 - gallery/gallery/lib/l10n/messages_es_VE.dart | 2 - gallery/gallery/lib/l10n/messages_et.dart | 2 - gallery/gallery/lib/l10n/messages_eu.dart | 2 - gallery/gallery/lib/l10n/messages_fa.dart | 2 - gallery/gallery/lib/l10n/messages_fi.dart | 2 - gallery/gallery/lib/l10n/messages_fil.dart | 2 - gallery/gallery/lib/l10n/messages_fr.dart | 2 - gallery/gallery/lib/l10n/messages_fr_CA.dart | 2 - gallery/gallery/lib/l10n/messages_fr_CH.dart | 2 - gallery/gallery/lib/l10n/messages_gl.dart | 2 - gallery/gallery/lib/l10n/messages_gsw.dart | 2 - gallery/gallery/lib/l10n/messages_gu.dart | 2 - gallery/gallery/lib/l10n/messages_he.dart | 2 - gallery/gallery/lib/l10n/messages_hi.dart | 2 - gallery/gallery/lib/l10n/messages_hr.dart | 2 - gallery/gallery/lib/l10n/messages_hu.dart | 2 - gallery/gallery/lib/l10n/messages_hy.dart | 2 - gallery/gallery/lib/l10n/messages_id.dart | 2 - gallery/gallery/lib/l10n/messages_is.dart | 2 - gallery/gallery/lib/l10n/messages_it.dart | 2 - gallery/gallery/lib/l10n/messages_ja.dart | 2 - gallery/gallery/lib/l10n/messages_ka.dart | 2 - gallery/gallery/lib/l10n/messages_kk.dart | 2 - gallery/gallery/lib/l10n/messages_km.dart | 2 - gallery/gallery/lib/l10n/messages_kn.dart | 2 - gallery/gallery/lib/l10n/messages_ko.dart | 2 - gallery/gallery/lib/l10n/messages_ky.dart | 2 - gallery/gallery/lib/l10n/messages_lo.dart | 2 - gallery/gallery/lib/l10n/messages_lt.dart | 2 - gallery/gallery/lib/l10n/messages_lv.dart | 2 - gallery/gallery/lib/l10n/messages_mk.dart | 2 - gallery/gallery/lib/l10n/messages_ml.dart | 2 - gallery/gallery/lib/l10n/messages_mn.dart | 2 - gallery/gallery/lib/l10n/messages_mr.dart | 2 - gallery/gallery/lib/l10n/messages_ms.dart | 2 - gallery/gallery/lib/l10n/messages_my.dart | 2 - gallery/gallery/lib/l10n/messages_nb.dart | 2 - gallery/gallery/lib/l10n/messages_ne.dart | 2 - gallery/gallery/lib/l10n/messages_nl.dart | 2 - gallery/gallery/lib/l10n/messages_or.dart | 2 - gallery/gallery/lib/l10n/messages_pa.dart | 2 - gallery/gallery/lib/l10n/messages_pl.dart | 2 - gallery/gallery/lib/l10n/messages_pt.dart | 2 - gallery/gallery/lib/l10n/messages_pt_BR.dart | 2 - gallery/gallery/lib/l10n/messages_pt_PT.dart | 2 - gallery/gallery/lib/l10n/messages_ro.dart | 2 - gallery/gallery/lib/l10n/messages_ru.dart | 2 - gallery/gallery/lib/l10n/messages_si.dart | 2 - gallery/gallery/lib/l10n/messages_sk.dart | 2 - gallery/gallery/lib/l10n/messages_sl.dart | 2 - gallery/gallery/lib/l10n/messages_sq.dart | 2 - gallery/gallery/lib/l10n/messages_sr.dart | 2 - .../gallery/lib/l10n/messages_sr_Latn.dart | 2 - gallery/gallery/lib/l10n/messages_sv.dart | 2 - gallery/gallery/lib/l10n/messages_sw.dart | 2 - gallery/gallery/lib/l10n/messages_ta.dart | 2 - gallery/gallery/lib/l10n/messages_te.dart | 2 - gallery/gallery/lib/l10n/messages_th.dart | 2 - gallery/gallery/lib/l10n/messages_tl.dart | 2 - gallery/gallery/lib/l10n/messages_tr.dart | 2 - gallery/gallery/lib/l10n/messages_uk.dart | 2 - gallery/gallery/lib/l10n/messages_ur.dart | 2 - gallery/gallery/lib/l10n/messages_uz.dart | 2 - gallery/gallery/lib/l10n/messages_vi.dart | 2 - gallery/gallery/lib/l10n/messages_zh.dart | 2 - gallery/gallery/lib/l10n/messages_zh_CN.dart | 2 - gallery/gallery/lib/l10n/messages_zh_HK.dart | 2 - gallery/gallery/lib/l10n/messages_zh_TW.dart | 2 - gallery/gallery/lib/l10n/messages_zu.dart | 2 - 124 files changed, 502 insertions(+), 259 deletions(-) create mode 100644 gallery/gallery/lib/demos/cupertino/cupertino_text_field_demo.dart diff --git a/gallery/gallery/lib/codeviewer/code_segments.dart b/gallery/gallery/lib/codeviewer/code_segments.dart index bce44a927..013a8d11f 100644 --- a/gallery/gallery/lib/codeviewer/code_segments.dart +++ b/gallery/gallery/lib/codeviewer/code_segments.dart @@ -10119,6 +10119,352 @@ class CodeSegments { ]); } + static TextSpan cupertinoTextFieldDemo(BuildContext context) { + final CodeStyle codeStyle = CodeStyle.of(context); + return TextSpan(children: [ + TextSpan( + style: codeStyle.commentStyle, + text: '// Copyright 2019 The Flutter team. All rights reserved.'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a'), + TextSpan( + style: codeStyle.commentStyle, + text: + '// Use of this source code is governed by a BSD-style license that can be'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a'), + TextSpan( + style: codeStyle.commentStyle, text: '// found in the LICENSE file.'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'), + TextSpan(style: codeStyle.keywordStyle, text: 'import'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.stringStyle, + text: '\u0027package:flutter/cupertino.dart\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a'), + TextSpan(style: codeStyle.keywordStyle, text: 'import'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan( + style: codeStyle.stringStyle, + text: '\u0027package:gallery/l10n/gallery_localizations.dart\u0027'), + TextSpan(style: codeStyle.punctuationStyle, text: ';'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'), + TextSpan(style: codeStyle.keywordStyle, text: 'class'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoTextFieldDemo'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'extends'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'StatelessWidget'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: '@override'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'Widget'), + TextSpan(style: codeStyle.baseStyle, text: ' build'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.classStyle, text: 'BuildContext'), + TextSpan(style: codeStyle.baseStyle, text: ' context'), + TextSpan(style: codeStyle.punctuationStyle, text: ')'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '{'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'final'), + TextSpan(style: codeStyle.baseStyle, text: ' localizations '), + TextSpan(style: codeStyle.punctuationStyle, text: '='), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'GalleryLocalizations'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'of'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'context'), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.keywordStyle, text: 'return'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoPageScaffold'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a navigationBar'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoNavigationBar'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a automaticallyImplyLeading'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'false'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a middle'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'Text'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'localizations'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'demoCupertinoTextFieldTitle'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'SafeArea'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'ListView'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a padding'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'EdgeInsets'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'all'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.numberStyle, text: '16'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a children'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.punctuationStyle, text: '['), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'Padding'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a padding'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'EdgeInsets'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'symmetric'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'vertical'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '8'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoTextField'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a placeholder'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' localizations'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'demoTextFieldEmail'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a keyboardType'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'TextInputType'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'emailAddress'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a clearButtonMode'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'OverlayVisibilityMode'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'editing'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a autocorrect'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'false'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'Padding'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a padding'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'const'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'EdgeInsets'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'symmetric'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'vertical'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '8'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a child'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoTextField'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a placeholder'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' localizations'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'rallyLoginPassword'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a clearButtonMode'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'OverlayVisibilityMode'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'editing'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a obscureText'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'true'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a autocorrect'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.keywordStyle, text: 'false'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoTextField'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a prefix'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'Icon'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoIcons'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'padlock_solid'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a size'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '28'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a padding'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'EdgeInsets'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'symmetric'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan(style: codeStyle.baseStyle, text: 'horizontal'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '6'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: ' vertical'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '12'), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan( + style: codeStyle.baseStyle, + text: '\u000a clearButtonMode'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'OverlayVisibilityMode'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'editing'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a keyboardType'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'TextInputType'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'number'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a decoration'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'BoxDecoration'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a border'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'Border'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a bottom'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'BorderSide'), + TextSpan(style: codeStyle.punctuationStyle, text: '('), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a width'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.numberStyle, text: '0'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a color'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' '), + TextSpan(style: codeStyle.classStyle, text: 'CupertinoColors'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'inactiveGray'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan( + style: codeStyle.baseStyle, text: '\u000a placeholder'), + TextSpan(style: codeStyle.punctuationStyle, text: ':'), + TextSpan(style: codeStyle.baseStyle, text: ' localizations'), + TextSpan(style: codeStyle.punctuationStyle, text: '.'), + TextSpan(style: codeStyle.baseStyle, text: 'demoCupertinoTextFieldPIN'), + TextSpan(style: codeStyle.punctuationStyle, text: ','), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '],'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '),'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: ');'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a '), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a'), + TextSpan(style: codeStyle.punctuationStyle, text: '}'), + TextSpan(style: codeStyle.baseStyle, text: '\u000a\u000a'), + ]); + } + static TextSpan customSlidersDemo(BuildContext context) { final CodeStyle codeStyle = CodeStyle.of(context); return TextSpan(children: [ diff --git a/gallery/gallery/lib/data/demos.dart b/gallery/gallery/lib/data/demos.dart index 509296d96..d30498ac5 100644 --- a/gallery/gallery/lib/data/demos.dart +++ b/gallery/gallery/lib/data/demos.dart @@ -17,6 +17,7 @@ import 'package:gallery/demos/cupertino/cupertino_segmented_control_demo.dart'; import 'package:gallery/demos/cupertino/cupertino_slider_demo.dart'; import 'package:gallery/demos/cupertino/cupertino_switch_demo.dart'; import 'package:gallery/demos/cupertino/cupertino_tab_bar_demo.dart'; +import 'package:gallery/demos/cupertino/cupertino_text_field_demo.dart'; import 'package:gallery/demos/material/bottom_app_bar_demo.dart'; import 'package:gallery/demos/material/bottom_navigation_demo.dart'; import 'package:gallery/demos/material/bottom_sheet_demo.dart'; @@ -671,6 +672,21 @@ List cupertinoDemos(BuildContext context) { ), ], ), + GalleryDemo( + title: localizations.demoCupertinoTextFieldTitle, + icon: GalleryIcons.textFieldsAlt, + subtitle: localizations.demoCupertinoTextFieldSubtitle, + configurations: [ + GalleryDemoConfiguration( + title: localizations.demoCupertinoTextFieldTitle, + description: localizations.demoCupertinoTextFieldDescription, + documentationUrl: + '$_docsBaseUrl/cupertino/CupertinoTextField-class.html', + buildRoute: (_) => CupertinoTextFieldDemo(), + code: CodeSegments.cupertinoTextFieldDemo, + ), + ], + ), ]; } diff --git a/gallery/gallery/lib/demos/cupertino/cupertino_text_field_demo.dart b/gallery/gallery/lib/demos/cupertino/cupertino_text_field_demo.dart new file mode 100644 index 000000000..f728a85c4 --- /dev/null +++ b/gallery/gallery/lib/demos/cupertino/cupertino_text_field_demo.dart @@ -0,0 +1,66 @@ +// Copyright 2019 The Flutter team. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'package:flutter/cupertino.dart'; +import 'package:gallery/l10n/gallery_localizations.dart'; + +// BEGIN cupertinoTextFieldDemo + +class CupertinoTextFieldDemo extends StatelessWidget { + @override + Widget build(BuildContext context) { + final localizations = GalleryLocalizations.of(context); + return CupertinoPageScaffold( + navigationBar: CupertinoNavigationBar( + automaticallyImplyLeading: false, + middle: Text(localizations.demoCupertinoTextFieldTitle), + ), + child: SafeArea( + child: ListView( + padding: const EdgeInsets.all(16), + children: [ + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: CupertinoTextField( + placeholder: localizations.demoTextFieldEmail, + keyboardType: TextInputType.emailAddress, + clearButtonMode: OverlayVisibilityMode.editing, + autocorrect: false, + ), + ), + Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: CupertinoTextField( + placeholder: localizations.rallyLoginPassword, + clearButtonMode: OverlayVisibilityMode.editing, + obscureText: true, + autocorrect: false, + ), + ), + CupertinoTextField( + prefix: Icon( + CupertinoIcons.padlock_solid, + size: 28, + ), + padding: EdgeInsets.symmetric(horizontal: 6, vertical: 12), + clearButtonMode: OverlayVisibilityMode.editing, + keyboardType: TextInputType.number, + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + width: 0, + color: CupertinoColors.inactiveGray, + ), + ), + ), + placeholder: localizations.demoCupertinoTextFieldPIN, + ), + ], + ), + ), + ); + } +} + +// END diff --git a/gallery/gallery/lib/l10n/gallery_localizations.dart b/gallery/gallery/lib/l10n/gallery_localizations.dart index 15bae6bd3..0ab94ba9f 100644 --- a/gallery/gallery/lib/l10n/gallery_localizations.dart +++ b/gallery/gallery/lib/l10n/gallery_localizations.dart @@ -1413,13 +1413,6 @@ class GalleryLocalizations { desc: r'Title for bottom sheet demo.'); } - String get demoBottomTextFieldsTitle { - return Intl.message(r'Text fields', - locale: _localeName, - name: 'demoBottomTextFieldsTitle', - desc: r'Title for text fields demo.'); - } - String get demoButtonSubtitle { return Intl.message(r'Flat, raised, outline, and more', locale: _localeName, @@ -1803,6 +1796,36 @@ class GalleryLocalizations { desc: r'Title for the cupertino bottom tab bar demo.'); } + String get demoCupertinoTextFieldDescription { + return Intl.message( + r'A text field lets the user enter text, either with a hardware keyboard or with an onscreen keyboard.', + locale: _localeName, + name: 'demoCupertinoTextFieldDescription', + desc: r'Description for the cupertino text field demo.'); + } + + String get demoCupertinoTextFieldPIN { + return Intl.message(r'PIN', + locale: _localeName, + name: 'demoCupertinoTextFieldPIN', + desc: + r'The placeholder for a text field where a user would enter their PIN number.'); + } + + String get demoCupertinoTextFieldSubtitle { + return Intl.message(r'iOS-style text fields', + locale: _localeName, + name: 'demoCupertinoTextFieldSubtitle', + desc: r'Subtitle for the cupertino text field demo.'); + } + + String get demoCupertinoTextFieldTitle { + return Intl.message(r'Text Fields', + locale: _localeName, + name: 'demoCupertinoTextFieldTitle', + desc: r'Title for the cupertino text field demo.'); + } + String get demoCustomSlidersDescription { return Intl.message( r'Sliders reflect a range of values along a bar, from which users may select a single value or range of values. The sliders can be themed and customized.', @@ -2518,7 +2541,7 @@ class GalleryLocalizations { } String get demoTextFieldEmail { - return Intl.message(r'E-mail', + return Intl.message(r'Email', locale: _localeName, name: 'demoTextFieldEmail', desc: r'The label for an email address input field'); diff --git a/gallery/gallery/lib/l10n/intl_en_US.arb b/gallery/gallery/lib/l10n/intl_en_US.arb index 7c6d0dc95..b56a0316a 100644 --- a/gallery/gallery/lib/l10n/intl_en_US.arb +++ b/gallery/gallery/lib/l10n/intl_en_US.arb @@ -973,6 +973,22 @@ "@cupertinoTabBarProfileTab": { "description": "Title for the profile tab in the bottom tab bar demo." }, + "demoCupertinoTextFieldTitle": "Text Fields", + "@demoCupertinoTextFieldTitle": { + "description": "Title for the cupertino text field demo." + }, + "demoCupertinoTextFieldSubtitle": "iOS-style text fields", + "@demoCupertinoTextFieldSubtitle": { + "description": "Subtitle for the cupertino text field demo." + }, + "demoCupertinoTextFieldDescription": "A text field lets the user enter text, either with a hardware keyboard or with an onscreen keyboard.", + "@demoCupertinoTextFieldDescription": { + "description": "Description for the cupertino text field demo." + }, + "demoCupertinoTextFieldPIN": "PIN", + "@demoCupertinoTextFieldPIN": { + "description": "The placeholder for a text field where a user would enter their PIN number." + }, "demoColorsTitle": "Colors", "@demoColorsTitle": { "description": "Title for the colors demo." @@ -1166,14 +1182,6 @@ "@demoSelectionControlsSwitchDescription": { "description": "Description for the switches (selection controls) demo." }, - "demoBottomTextFieldsTitle": "Text fields", - "@demoBottomTextFieldsTitle": { - "description": "Title for text fields demo." - }, - "demoBottomSheetSubtitle": "Persistent and modal bottom sheets", - "@demoBottomSheetSubtitle": { - "description": "Description for bottom sheet demo." - }, "demoTextFieldTitle": "Text fields", "@demoTextFieldTitle": { "description": "Title for text fields demo." @@ -1238,7 +1246,7 @@ "@demoTextFieldYourEmailAddress": { "description": "The label for an email address input field." }, - "demoTextFieldEmail": "E-mail", + "demoTextFieldEmail": "Email", "@demoTextFieldEmail": { "description": "The label for an email address input field" }, diff --git a/gallery/gallery/lib/l10n/intl_en_US.xml b/gallery/gallery/lib/l10n/intl_en_US.xml index 9e304e65e..2e9bc50f2 100644 --- a/gallery/gallery/lib/l10n/intl_en_US.xml +++ b/gallery/gallery/lib/l10n/intl_en_US.xml @@ -917,6 +917,22 @@ name="cupertinoTabBarProfileTab" description="Title for the profile tab in the bottom tab bar demo." >Profile + Text Fields + iOS-style text fields + A text field lets the user enter text, either with a hardware keyboard or with an onscreen keyboard. + PIN On/off switches toggle the state of a single settings option. The option that the switch controls, as well as the state it’s in, should be made clear from the corresponding inline label. - Text fields E-mail + >Email