Unverified Commit 766e0fa9 authored by Justin McCandless's avatar Justin McCandless Committed by GitHub

Export characters (#59620)

parent 2e63b7d4
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
library widgets; library widgets;
export 'package:vector_math/vector_math_64.dart' show Matrix4; export 'package:vector_math/vector_math_64.dart' show Matrix4;
export 'package:characters/characters.dart';
export 'src/widgets/actions.dart'; export 'src/widgets/actions.dart';
export 'src/widgets/animated_cross_fade.dart'; export 'src/widgets/animated_cross_fade.dart';
......
...@@ -5022,6 +5022,32 @@ void main() { ...@@ -5022,6 +5022,32 @@ void main() {
expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.text); expect(RendererBinding.instance.mouseTracker.debugDeviceActiveCursor(1), SystemMouseCursors.text);
}); });
testWidgets('Can access characters on editing string', (WidgetTester tester) async {
int charactersLength;
final Widget widget = MaterialApp(
home: EditableText(
backgroundCursorColor: Colors.grey,
controller: TextEditingController(),
focusNode: FocusNode(),
style: Typography.material2018(platform: TargetPlatform.android).black.subtitle1,
cursorColor: Colors.blue,
selectionControls: materialTextSelectionControls,
keyboardType: TextInputType.text,
onChanged: (String value) {
charactersLength = value.characters.length;
},
),
);
await tester.pumpWidget(widget);
// Enter an extended grapheme cluster whose string length is different than
// its characters length.
await tester.enterText(find.byType(EditableText), '👨‍👩‍👦');
await tester.pump();
expect(charactersLength, 1);
});
testWidgets('EditableText can set and update clipBehavior', (WidgetTester tester) async { testWidgets('EditableText can set and update clipBehavior', (WidgetTester tester) async {
await tester.pumpWidget(MediaQuery( await tester.pumpWidget(MediaQuery(
data: const MediaQueryData(devicePixelRatio: 1.0), data: const MediaQueryData(devicePixelRatio: 1.0),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment