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:
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(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user