部分登录
This commit is contained in:
119
lib/login/login_view.dart
Normal file
119
lib/login/login_view.dart
Normal file
@@ -0,0 +1,119 @@
|
||||
import 'package:cashier_reserve/common/print/print.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class LoginView extends StatefulWidget {
|
||||
const LoginView({super.key});
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
return _LoginViewState();
|
||||
}
|
||||
}
|
||||
|
||||
class _LoginViewState extends State<LoginView> {
|
||||
String loginType = "merchant";
|
||||
int segmentIndex = 0;
|
||||
|
||||
TextEditingController merchantText = TextEditingController();
|
||||
TextEditingController accountText = TextEditingController();
|
||||
TextEditingController passwordText = TextEditingController();
|
||||
TextEditingController codeText = TextEditingController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
merchantText.dispose();
|
||||
accountText.dispose();
|
||||
passwordText.dispose();
|
||||
codeText.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
color: const Color(0x55000000),
|
||||
child: Center(
|
||||
child: Container(
|
||||
padding: const EdgeInsets.fromLTRB(30, 30, 30, 30),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
width: 400,
|
||||
height: 400,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
"银收客订餐系统",
|
||||
style: TextStyle(
|
||||
fontSize: 25,
|
||||
color: Color(0xff333333),
|
||||
decoration: TextDecoration.none),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
CupertinoSegmentedControl(
|
||||
//子标签
|
||||
children: {
|
||||
0: Container(
|
||||
width: 60,
|
||||
height: 30,
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
"商户",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
// color: Color(0xff333333),
|
||||
decoration: TextDecoration.none),
|
||||
),
|
||||
),
|
||||
1: Container(
|
||||
width: 60,
|
||||
height: 30,
|
||||
alignment: Alignment.center,
|
||||
child: const Text(
|
||||
"员工",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
// color: Color(0xff333333),
|
||||
decoration: TextDecoration.none),
|
||||
),
|
||||
),
|
||||
},
|
||||
//当前选中的索引
|
||||
groupValue: segmentIndex,
|
||||
//点击回调
|
||||
onValueChanged: (int index) {
|
||||
setState(() {
|
||||
segmentIndex = index;
|
||||
loginType = index == 0 ? "merchant" : "staff";
|
||||
});
|
||||
},
|
||||
selectedColor: Colors.blue,
|
||||
borderColor: Colors.blue,
|
||||
unselectedColor: Colors.white,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
// TextField(
|
||||
// controller: merchantText,
|
||||
// )
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user