You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.1 KiB
Dart
73 lines
2.1 KiB
Dart
import 'package:car_customer_app/generated/locale_keys.g.dart';
|
|
import 'package:easy_localization/src/public_ext.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
enum ClassType { EMAIL, NUMBER }
|
|
|
|
class LoginEmailTab extends StatefulWidget {
|
|
Function(ClassType) onSelection;
|
|
|
|
LoginEmailTab({required this.onSelection});
|
|
|
|
@override
|
|
State<LoginEmailTab> createState() => _LoginEmailTabState();
|
|
}
|
|
|
|
class _LoginEmailTabState extends State<LoginEmailTab> {
|
|
ClassType type = ClassType.NUMBER;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: double.infinity,
|
|
child: Row(
|
|
children: [
|
|
Expanded(
|
|
child: InkWell(
|
|
onTap: () {
|
|
type = ClassType.NUMBER;
|
|
widget.onSelection(ClassType.NUMBER);
|
|
},
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: 45,
|
|
color: type == ClassType.NUMBER ? Colors.blue : Colors.transparent,
|
|
child: Center(
|
|
child: Text(
|
|
LocaleKeys.number.tr(),
|
|
style: TextStyle(
|
|
color: type == ClassType.NUMBER ? Colors.white : Colors.black,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
Expanded(
|
|
child: InkWell(
|
|
onTap: () {
|
|
type = ClassType.EMAIL;
|
|
widget.onSelection(ClassType.EMAIL);
|
|
},
|
|
child: Container(
|
|
width: double.infinity,
|
|
height: 45,
|
|
color: type == ClassType.EMAIL ? Colors.blue : Colors.transparent,
|
|
child: Center(
|
|
child: Text(
|
|
LocaleKeys.email.tr(),
|
|
style: TextStyle(
|
|
color: type == ClassType.EMAIL ? Colors.white : Colors.black,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
)),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|