import 'package:flutter/material.dart'; enum ClassType { EMAIL, NUMBER } class LoginEmailTab extends StatefulWidget { Function(ClassType) onSelection; LoginEmailTab({required this.onSelection}); @override State createState() => _LoginEmailTabState(); } class _LoginEmailTabState extends State { 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( "Number", 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( "Email", style: TextStyle( color: type == ClassType.EMAIL ? Colors.white : Colors.black, fontWeight: FontWeight.bold, ), )), ), ), ), ], ), ); } }