diff --git a/examples/api/lib/ui/text/font_feature.0.dart b/examples/api/lib/ui/text/font_feature.0.dart new file mode 100644 index 0000000000..070333eb7e --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.0.dart @@ -0,0 +1,79 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature +import 'dart:ui'; + +import 'package:flutter/material.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return const MaterialApp( + home: ExampleWidget(), + ); + } +} + +final TextStyle titleStyle = TextStyle( + fontSize: 18, + fontFeatures: const [FontFeature.enable('smcp')], + color: Colors.blueGrey[600], +); + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Cardo, Milonga and Raleway Dots fonts can be downloaded from + // Google Fonts (https://www.google.com/fonts). + return Scaffold( + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + const Spacer(flex: 5), + Text('regular numbers have their place:', style: titleStyle), + const Text('The 1972 cup final was a 1-1 draw.', + style: TextStyle( + fontFamily: 'Cardo', + fontSize: 24, + )), + const Spacer(), + Text('but old-style figures blend well with lower case:', style: titleStyle), + const Text('The 1972 cup final was a 1-1 draw.', + style: TextStyle( + fontFamily: 'Cardo', fontSize: 24, fontFeatures: [FontFeature.oldstyleFigures()])), + const Spacer(), + const Divider(), + const Spacer(), + Text('fractions look better with a custom ligature:', style: titleStyle), + const Text('Add 1/2 tsp of flour and stir.', + style: TextStyle( + fontFamily: 'Milonga', + fontSize: 24, + fontFeatures: [FontFeature.alternativeFractions()])), + const Spacer(), + const Divider(), + const Spacer(), + Text('multiple stylistic sets in one font:', style: titleStyle), + const Text('Raleway Dots', style: TextStyle(fontFamily: 'Raleway Dots', fontSize: 48)), + Text('Raleway Dots', + style: TextStyle( + fontFeatures: [FontFeature.stylisticSet(1)], + fontFamily: 'Raleway Dots', + fontSize: 48, + )), + const Spacer(flex: 5), + ], + ), + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart new file mode 100644 index 0000000000..ce2155acba --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_alternative.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.alternative +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Raleway font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'The infamous Tuna Torture.', + style: TextStyle( + fontFamily: 'Raleway', + fontFeatures: [ + FontFeature.alternative(1), // or 2, or 3, or... + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart new file mode 100644 index 0000000000..3ceebb4ed1 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_alternative_fractions.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.alternativeFractions +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Ubuntu Mono font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'Fractions: 1/2 2/3 3/4 4/5', + style: TextStyle( + fontFamily: 'Ubuntu Mono', + fontFeatures: [ + FontFeature.alternativeFractions(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart new file mode 100644 index 0000000000..a70f5b389c --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.caseSensitiveForms +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Piazzolla font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + '(A) [A] {A} «A» A/B A•B', + style: TextStyle( + fontFamily: 'Piazzolla', + fontFeatures: [ + FontFeature.caseSensitiveForms(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart new file mode 100644 index 0000000000..58c4eed650 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_character_variant.0.dart @@ -0,0 +1,42 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.characterVariant +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Source Code Pro font can be downloaded from Google Fonts (https://www.google.com/fonts). + return Text( + 'aáâ β gǵĝ θб Iiíî Ll', + style: TextStyle( + fontFamily: 'Source Code Pro', + fontFeatures: [ + FontFeature.characterVariant(1), + FontFeature.characterVariant(2), + FontFeature.characterVariant(4), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart new file mode 100644 index 0000000000..05fadd8900 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_contextual_alternates.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.contextualAlternates +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Barriecito font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + "Ooohh, we weren't going to tell him that.", + style: TextStyle( + fontFamily: 'Barriecito', + fontFeatures: [ + FontFeature.contextualAlternates(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart new file mode 100644 index 0000000000..516ba413cc --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_denominator.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.denominator +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Piazzolla font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'Fractions: 1/2 2/3 3/4 4/5', + style: TextStyle( + fontFamily: 'Piazzolla', + fontFeatures: [ + FontFeature.denominator(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart new file mode 100644 index 0000000000..306d463eb3 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_fractions.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.fractions +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Ubuntu Mono font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'Fractions: 1/2 2/3 3/4 4/5', + style: TextStyle( + fontFamily: 'Ubuntu Mono', + fontFeatures: [ + FontFeature.fractions(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart new file mode 100644 index 0000000000..81d6a4792c --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_historical_forms.0.dart @@ -0,0 +1,41 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.historicalForms +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Cardo font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'VIBRANT fish assisted his business.', + style: TextStyle( + fontFamily: 'Sorts Mill Goudy', + fontFeatures: [ + FontFeature.historicalForms(), // Enables "hist". + // Use FontFeature.historicalLigatures() to enable "hlig" as well. + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart new file mode 100644 index 0000000000..459f1ca7f2 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_historical_ligatures.0.dart @@ -0,0 +1,42 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.historicalLigatures + +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Cardo font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'VIBRANT fish assisted his business.', + style: TextStyle( + fontFamily: 'Sorts Mill Goudy', + fontFeatures: [ + FontFeature.historicalForms(), // Enables "hist". + FontFeature.historicalLigatures() // Enables "hlig". + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart new file mode 100644 index 0000000000..26cf4eb520 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_lining_figures.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.liningFigures +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Sorts Mill Goudy font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'CALL 311-555-2368 NOW!', + style: TextStyle( + fontFamily: 'Sorts Mill Goudy', + fontFeatures: [ + FontFeature.liningFigures(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart new file mode 100644 index 0000000000..b45b0976e2 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_locale_aware.0.dart @@ -0,0 +1,38 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.localeAware +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Noto family of fonts can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + '次 化 刃 直 入 令', + locale: Locale('zh', 'CN'), // or Locale('ja'), Locale('ko'), Locale('zh', 'TW'), etc + style: TextStyle( + fontFamily: 'Noto Sans', + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart new file mode 100644 index 0000000000..e617a75cf3 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_notational_forms.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.notationalForms +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Gothic A1 font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'abc 123', + style: TextStyle( + fontFamily: 'Gothic A1', + fontFeatures: [ + FontFeature.notationalForms(3), // circled letters and digits + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart new file mode 100644 index 0000000000..d7af51cba7 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_numerators.0.dart @@ -0,0 +1,41 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.numerators +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +/// This is the stateless widget that the main application instantiates. +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Piazzolla font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'Fractions: 1/2 2/3 3/4 4/5', + style: TextStyle( + fontFamily: 'Piazzolla', + fontFeatures: [ + FontFeature.numerators(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart new file mode 100644 index 0000000000..a18d239994 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_oldstyle_figures.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.oldstyleFigures +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Piazzolla font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'Call 311-555-2368 now!', + style: TextStyle( + fontFamily: 'Piazzolla', + fontFeatures: [ + FontFeature.oldstyleFigures(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart new file mode 100644 index 0000000000..4b8ef03627 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_ordinal_forms.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.ordinalForms +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Piazzolla font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + '1st, 2nd, 3rd, 4th...', + style: TextStyle( + fontFamily: 'Piazzolla', + fontFeatures: [ + FontFeature.ordinalForms(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart new file mode 100644 index 0000000000..4113b79b13 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_proportional_figures.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.proportionalFigures +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Kufam font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'Call 311-555-2368 now!', + style: TextStyle( + fontFamily: 'Kufam', + fontFeatures: [ + FontFeature.proportionalFigures(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart new file mode 100644 index 0000000000..f30a35dd28 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_scientific_inferiors.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.scientificInferiors +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Piazzolla font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'C8H10N4O2', + style: TextStyle( + fontFamily: 'Piazzolla', + fontFeatures: [ + FontFeature.scientificInferiors(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart new file mode 100644 index 0000000000..ae1873913f --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_slashed_zero.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.slashedZero +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Source Code Pro font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'One million is: 1,000,000.00', + style: TextStyle( + fontFamily: 'Source Code Pro', + fontFeatures: [ + FontFeature.slashedZero(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart new file mode 100644 index 0000000000..d1dc90099e --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_alternates.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.stylisticAlternates +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Source Code Pro font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + r'Agile Game - $100 initial bet', + style: TextStyle( + fontFamily: 'Source Code Pro', + fontFeatures: [ + FontFeature.stylisticAlternates(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart new file mode 100644 index 0000000000..70dd1d6d3a --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.0.dart @@ -0,0 +1,42 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.stylisticSet +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Source Code Pro font can be downloaded from Google Fonts (https://www.google.com/fonts). + return Text( + 'aáâ β gǵĝ θб Iiíî Ll', + style: TextStyle( + fontFamily: 'Source Code Pro', + fontFeatures: [ + FontFeature.stylisticSet(2), + FontFeature.stylisticSet(3), + FontFeature.stylisticSet(4), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart new file mode 100644 index 0000000000..650f036468 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_stylistic_set.1.dart @@ -0,0 +1,41 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.stylisticSet +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Piazzolla font can be downloaded from Google Fonts (https://www.google.com/fonts). + return Text( + '-> MCMXCVII <-', // 1997 + style: TextStyle( + fontFamily: 'Piazzolla', + fontFeatures: [ + FontFeature.stylisticSet(1), + FontFeature.stylisticSet(2), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart new file mode 100644 index 0000000000..cfaea355e7 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_subscripts.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.subscripts +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Piazzolla font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'Line from x1,y1 to x2,y2', + style: TextStyle( + fontFamily: 'Piazzolla', + fontFeatures: [ + FontFeature.subscripts(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart new file mode 100644 index 0000000000..81d64781a2 --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.superscripts +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Sorts Mill Goudy font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'The isotope 238U decays to 206Pb', + style: TextStyle( + fontFamily: 'Sorts Mill Goudy', + fontFeatures: [ + FontFeature.superscripts(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart new file mode 100644 index 0000000000..bebf97c3cd --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_swash.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for FontFeature.FontFeature.swash +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The BioRhyme Expanded font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'Queer & Romantic', + style: TextStyle( + fontFamily: 'BioRhyme Expanded', + fontFeatures: [ + FontFeature.swash(), + ], + ), + ); + } +} diff --git a/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart b/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart new file mode 100644 index 0000000000..989def890e --- /dev/null +++ b/examples/api/lib/ui/text/font_feature.font_feature_tabular_figures.0.dart @@ -0,0 +1,40 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flutter code sample for dart:ui FontFeature.FontFeature.tabularFigures +import 'dart:ui'; + +import 'package:flutter/widgets.dart'; + +void main() => runApp(const ExampleApp()); + +class ExampleApp extends StatelessWidget { + const ExampleApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return WidgetsApp( + builder: (BuildContext context, Widget? navigator) => const ExampleWidget(), + color: const Color(0xffffffff), + ); + } +} + +class ExampleWidget extends StatelessWidget { + const ExampleWidget({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + // The Piazzolla font can be downloaded from Google Fonts (https://www.google.com/fonts). + return const Text( + 'Call 311-555-2368 now!', + style: TextStyle( + fontFamily: 'Piazzolla', + fontFeatures: [ + FontFeature.tabularFigures(), + ], + ), + ); + } +} diff --git a/examples/api/test/material/ink/ink.image_clip.0.test.dart b/examples/api/test/material/ink/ink.image_clip.0_test.dart similarity index 100% rename from examples/api/test/material/ink/ink.image_clip.0.test.dart rename to examples/api/test/material/ink/ink.image_clip.0_test.dart diff --git a/examples/api/test/material/ink/ink.image_clip.1.test.dart b/examples/api/test/material/ink/ink.image_clip.1_test.dart similarity index 100% rename from examples/api/test/material/ink/ink.image_clip.1.test.dart rename to examples/api/test/material/ink/ink.image_clip.1_test.dart diff --git a/examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0.test.dart b/examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0_test.dart similarity index 100% rename from examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0.test.dart rename to examples/api/test/material/input_decorator/input_decoration.floating_label_style_error.0_test.dart diff --git a/examples/api/test/material/input_decorator/input_decoration.label_style_error.0.test.dart b/examples/api/test/material/input_decorator/input_decoration.label_style_error.0_test.dart similarity index 100% rename from examples/api/test/material/input_decorator/input_decoration.label_style_error.0.test.dart rename to examples/api/test/material/input_decorator/input_decoration.label_style_error.0_test.dart diff --git a/examples/api/test/ui/text/font_feature.0_test.dart b/examples/api/test/ui/text/font_feature.0_test.dart new file mode 100644 index 0000000000..edd4db793c --- /dev/null +++ b/examples/api/test/ui/text/font_feature.0_test.dart @@ -0,0 +1,29 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsNWidgets(9)); + expect((tester.widget(find.byType(Text).at(0)) as Text).style!.fontSize, equals(18.0)); + expect((tester.widget(find.byType(Text).at(1)) as Text).style!.fontFamily, equals('Cardo')); + expect((tester.widget(find.byType(Text).at(3)) as Text).style!.fontFeatures, + equals(const [FontFeature.oldstyleFigures()])); + expect((tester.widget(find.byType(Text).at(5)) as Text).style!.fontFeatures, + equals(const [FontFeature.alternativeFractions()])); + expect((tester.widget(find.byType(Text).at(8)) as Text).style!.fontFeatures, + equals([FontFeature.stylisticSet(1)])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_alternative.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_alternative.0_test.dart new file mode 100644 index 0000000000..7f57a116ca --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_alternative.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_alternative.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Raleway')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.alternative(1)])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_alternative_fractions.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_alternative_fractions.0_test.dart new file mode 100644 index 0000000000..8c2c8007ca --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_alternative_fractions.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_alternative_fractions.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Ubuntu Mono')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.alternativeFractions()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_case_sensitive_forms.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_case_sensitive_forms.0_test.dart new file mode 100644 index 0000000000..81ad5ca594 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_case_sensitive_forms.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_case_sensitive_forms.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.caseSensitiveForms()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_character_variant.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_character_variant.0_test.dart new file mode 100644 index 0000000000..018d0da8fa --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_character_variant.0_test.dart @@ -0,0 +1,29 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_character_variant.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Source Code Pro')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals([ + FontFeature.characterVariant(1), + FontFeature.characterVariant(2), + FontFeature.characterVariant(4), + ])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_contextual_alternates.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_contextual_alternates.0_test.dart new file mode 100644 index 0000000000..a692503b9b --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_contextual_alternates.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_contextual_alternates.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Barriecito')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.contextualAlternates()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_denominator.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_denominator.0_test.dart new file mode 100644 index 0000000000..3473cf0ea5 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_denominator.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_denominator.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.denominator()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_fractions.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_fractions.0_test.dart new file mode 100644 index 0000000000..ee02b18d46 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_fractions.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_fractions.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Ubuntu Mono')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.fractions()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_historical_forms.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_historical_forms.0_test.dart new file mode 100644 index 0000000000..58ec89276d --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_historical_forms.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_historical_forms.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Sorts Mill Goudy')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.historicalForms()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_historical_ligatures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_historical_ligatures.0_test.dart new file mode 100644 index 0000000000..f60ac5704a --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_historical_ligatures.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_historical_ligatures.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Sorts Mill Goudy')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.historicalForms(), FontFeature.historicalLigatures()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_lining_figures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_lining_figures.0_test.dart new file mode 100644 index 0000000000..a29abfde1b --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_lining_figures.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_lining_figures.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Sorts Mill Goudy')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.liningFigures()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_locale_aware.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_locale_aware.0_test.dart new file mode 100644 index 0000000000..c8a4d66359 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_locale_aware.0_test.dart @@ -0,0 +1,23 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_locale_aware.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Noto Sans')); + expect((tester.widget(find.byType(Text).first) as Text).locale, equals(const Locale('zh', 'CN'))); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_notational_forms.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_notational_forms.0_test.dart new file mode 100644 index 0000000000..8a9aa0d737 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_notational_forms.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_notational_forms.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Gothic A1')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.notationalForms(3)])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_numerators.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_numerators.0_test.dart new file mode 100644 index 0000000000..3fb41472f9 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_numerators.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_numerators.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.numerators()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_oldstyle_figures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_oldstyle_figures.0_test.dart new file mode 100644 index 0000000000..ea775073f5 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_oldstyle_figures.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_oldstyle_figures.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.oldstyleFigures()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_ordinal_forms.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_ordinal_forms.0_test.dart new file mode 100644 index 0000000000..25c926bf4a --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_ordinal_forms.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_ordinal_forms.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.ordinalForms()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_proportional_figures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_proportional_figures.0_test.dart new file mode 100644 index 0000000000..fedcc2f85c --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_proportional_figures.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_proportional_figures.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Kufam')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.proportionalFigures()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_scientific_inferiors.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_scientific_inferiors.0_test.dart new file mode 100644 index 0000000000..b1c82600a5 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_scientific_inferiors.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_scientific_inferiors.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.scientificInferiors()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_slashed_zero.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_slashed_zero.0_test.dart new file mode 100644 index 0000000000..7747067251 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_slashed_zero.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_slashed_zero.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Source Code Pro')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.slashedZero()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_stylistic_alternates.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_stylistic_alternates.0_test.dart new file mode 100644 index 0000000000..ab79d50c92 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_stylistic_alternates.0_test.dart @@ -0,0 +1,24 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_stylistic_alternates.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Source Code Pro')); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.stylisticAlternates()])); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.0_test.dart new file mode 100644 index 0000000000..c2e0aae7e4 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.0_test.dart @@ -0,0 +1,32 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_stylistic_set.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Source Code Pro')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals( + [ + FontFeature.stylisticSet(2), + FontFeature.stylisticSet(3), + FontFeature.stylisticSet(4), + ], + ), + ); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.1_test.dart b/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.1_test.dart new file mode 100644 index 0000000000..200e35bf4a --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_stylistic_set.1_test.dart @@ -0,0 +1,31 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_stylistic_set.1.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals( + [ + FontFeature.stylisticSet(1), + FontFeature.stylisticSet(2), + ], + ), + ); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_subscripts.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_subscripts.0_test.dart new file mode 100644 index 0000000000..80e7d21605 --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_subscripts.0_test.dart @@ -0,0 +1,26 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_subscripts.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.subscripts()]), + ); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_superscripts.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_superscripts.0_test.dart new file mode 100644 index 0000000000..951b60b70f --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_superscripts.0_test.dart @@ -0,0 +1,26 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_superscripts.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Sorts Mill Goudy')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.superscripts()]), + ); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_swash.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_swash.0_test.dart new file mode 100644 index 0000000000..7ab5624efc --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_swash.0_test.dart @@ -0,0 +1,26 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_swash.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('BioRhyme Expanded')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.swash()]), + ); + }); +} diff --git a/examples/api/test/ui/text/font_feature.font_feature_tabular_figures.0_test.dart b/examples/api/test/ui/text/font_feature.font_feature_tabular_figures.0_test.dart new file mode 100644 index 0000000000..57888d4b2f --- /dev/null +++ b/examples/api/test/ui/text/font_feature.font_feature_tabular_figures.0_test.dart @@ -0,0 +1,26 @@ +// Copyright 2014 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import 'dart:ui'; +import 'package:flutter/material.dart'; +import 'package:flutter/widgets.dart'; +import 'package:flutter_api_samples/ui/text/font_feature.font_feature_tabular_figures.0.dart' as example; +import 'package:flutter_test/flutter_test.dart'; + +void main() { + testWidgets('shows font features', (WidgetTester tester) async { + await tester.pumpWidget( + const MaterialApp( + home: example.ExampleWidget(), + ), + ); + + expect(find.byType(Text), findsOneWidget); + expect((tester.widget(find.byType(Text).first) as Text).style!.fontFamily, equals('Piazzolla')); + expect( + (tester.widget(find.byType(Text).first) as Text).style!.fontFeatures, + equals(const [FontFeature.tabularFigures()]), + ); + }); +}