我是颤振开发的新手,并试图了解 Riverpod。
我目前设法使以下登录表单与 StatefulWidget 一起使用。基本上,如果两个字段都不为空,则该按钮将被启用,反之亦然。
这是它的当前代码。
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Login Demo',
// theme: ThemeData(
// primarySwatch: Colors.blue,
// ),
home: Scaffold(
body: Center(
child: SizedBox(
width: 400,
child: MyLoginPage2(),
),
),
),
);
}
}
class MyLoginPage extends StatefulWidget {
const MyLoginPage({Key? key}) : super(key: key); …Run Code Online (Sandbox Code Playgroud)