mirror of
https://github.com/flutter/flutter
synced 2024-10-06 00:09:53 +00:00
Move examples from dart:ui ui/lib/text.dart to examples/api (#96557)
This extracts the examples that are in flutter/engine@main/lib/ui/text.dart into examples in the examples/api/lib/ui directory and adds some simple tests for them. Also, fixes some inconsistent test file naming. This is step 1: the next step is to remove the examples from the dart:ui code.
This commit is contained in:
parent
7428ab66b4
commit
017ed1792b
79
examples/api/lib/ui/text/font_feature.0.dart
Normal file
79
examples/api/lib/ui/text/font_feature.0.dart
Normal file
|
@ -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>[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: <Widget>[
|
||||
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>[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>[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>[FontFeature.stylisticSet(1)],
|
||||
fontFamily: 'Raleway Dots',
|
||||
fontSize: 48,
|
||||
)),
|
||||
const Spacer(flex: 5),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.alternative(1), // or 2, or 3, or...
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.alternativeFractions(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.caseSensitiveForms(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.characterVariant(1),
|
||||
FontFeature.characterVariant(2),
|
||||
FontFeature.characterVariant(4),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.contextualAlternates(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.denominator(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.fractions(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.historicalForms(), // Enables "hist".
|
||||
// Use FontFeature.historicalLigatures() to enable "hlig" as well.
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.historicalForms(), // Enables "hist".
|
||||
FontFeature.historicalLigatures() // Enables "hlig".
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.liningFigures(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.notationalForms(3), // circled letters and digits
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.numerators(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.oldstyleFigures(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.ordinalForms(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.proportionalFigures(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.scientificInferiors(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.slashedZero(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.stylisticAlternates(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.stylisticSet(2),
|
||||
FontFeature.stylisticSet(3),
|
||||
FontFeature.stylisticSet(4),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.stylisticSet(1),
|
||||
FontFeature.stylisticSet(2),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.subscripts(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.superscripts(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.swash(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.tabularFigures(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
29
examples/api/test/ui/text/font_feature.0_test.dart
Normal file
29
examples/api/test/ui/text/font_feature.0_test.dart
Normal file
|
@ -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>[FontFeature.oldstyleFigures()]));
|
||||
expect((tester.widget(find.byType(Text).at(5)) as Text).style!.fontFeatures,
|
||||
equals(const <FontFeature>[FontFeature.alternativeFractions()]));
|
||||
expect((tester.widget(find.byType(Text).at(8)) as Text).style!.fontFeatures,
|
||||
equals(<FontFeature>[FontFeature.stylisticSet(1)]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.alternative(1)]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.alternativeFractions()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.caseSensitiveForms()]));
|
||||
});
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.characterVariant(1),
|
||||
FontFeature.characterVariant(2),
|
||||
FontFeature.characterVariant(4),
|
||||
]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.contextualAlternates()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.denominator()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.fractions()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.historicalForms()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.historicalForms(), FontFeature.historicalLigatures()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.liningFigures()]));
|
||||
});
|
||||
}
|
|
@ -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')));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.notationalForms(3)]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.numerators()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.oldstyleFigures()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.ordinalForms()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.proportionalFigures()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.scientificInferiors()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.slashedZero()]));
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.stylisticAlternates()]));
|
||||
});
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.stylisticSet(2),
|
||||
FontFeature.stylisticSet(3),
|
||||
FontFeature.stylisticSet(4),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
|
@ -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>[
|
||||
FontFeature.stylisticSet(1),
|
||||
FontFeature.stylisticSet(2),
|
||||
],
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.subscripts()]),
|
||||
);
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.superscripts()]),
|
||||
);
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.swash()]),
|
||||
);
|
||||
});
|
||||
}
|
|
@ -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>[FontFeature.tabularFigures()]),
|
||||
);
|
||||
});
|
||||
}
|
Loading…
Reference in a new issue