16.2%
38.4%
2.2%
37.8%
-11.6%
37.5%
97.4%
9.3%
-11.4%
100%
14.1%
100%
100%
33%
14.2%
-48.2%
-46.7%
-11.6%
-82.9%
-84.4%
CustomPaint
widget. The problem is that every single time a small part of the editor changes, e.g. the cursor moves, I’m redrawing everything, including the text/chars, and this is slow. I’d like to, say, only update the cursor box position sometimes, while keeping the rest of what’s drawn on the Canvas
where it is without overwriting it. Is there any way I can do that (I can provide code if necessary)?
canvas.drawRect(...)
it seems to overwrite whatever else was drawn on the canvas.
@felpsisonfire This may help you: https://m.youtube.com/watch?feature=youtu.be&v=AnTX2mtOl9Q
Thank u very much!
this is my code
```
class Home extends StatefulWidget {
@override
_HomeState createState() => _HomeState();
}
class _HomeState extends State<Home> with SingleTickerProviderStateMixin {
final AuthService _auth = AuthService();
int _currentIndex = 0;
PageController _pageController;
@override
void initState() {
super.initState();
_pageController = PageController();
}
@override
void dispose() {
_pageController.dispose();
super.dispose();
}
Future<FirebaseUser> currentUser() async {
FirebaseAuth _firebaseInstance = FirebaseAuth.instance;
return _firebaseInstance.currentUser();
}
@override
Widget build(BuildContext context) {
return FutureBuilder(
future: currentUser(),
builder: (context, snapshot) {
if (snapshot.hasData) {
return StreamBuilder(
stream: Firestore.instance
.collection('users')
.document()
.snapshots(),
builder: (context, snapshot) {
if (snapshot.data['role'] == 'admin') {
return AdminHomePage();
} else {
return Home();
}
}
);}
return Scaffold(
resizeToAvoidBottomPadding: true,
drawer: Container(
height: 200,
child: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 10 , right: 13),
child: ListTile(
title: Text('Login'),
onTap: (){
Navigator.push(context, MaterialPageRoute(
builder:(context){
return LoginPage();
},));},
),
),
ListTile(
title: Text('Logout'),
onTap: ()async{
await _auth.signOut();
},
),
ListTile(
title: Text('Register'),
onTap: (){
Navigator.push(context, MaterialPageRoute(
builder:(context){
return RegisterPage();
}));})],
),
),
),