-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Description
Note: I ran this in the Dartpad. there's no need to create a new flutter project.
- Run
flutter create bug. - Update the files as follows: gist.github.com/b6409e10de32b280b8938aa75364fa7b
///main.dart
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
final TextEditingController _controller = TextEditingController();
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
void dispose(){
_controller.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
TextField(
decoration: InputDecoration(
labelText: "Type more than 9 Characters, then try to use the backspace key",
),
controller: _controller,
onChanged: (value){
print(_controller.text);
},
maxLength: 9,
),
],
),
),
);
}
}
- After entering more than specified maximum length characters in the textfield. the backspace won't delete the last character.
Expected results:
Should Delete the last Character based on the specified maxLength property
Actual results:
Did not delete the last character.
Logs
Metadata
Metadata
Assignees
Labels
No labels