flutter/examples/api/lib/ui/text/font_feature.font_feature_superscripts.0.dart
Greg Spencer 017ed1792b
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.
2022-01-14 15:42:54 -08:00

41 lines
1.1 KiB
Dart

// 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(),
],
),
);
}
}