45 lines
1.2 KiB
Dart
45 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:prosappco/blocs/my_user_bloc/my_user_bloc.dart';
|
|
|
|
class ProfilePhoneScreen extends StatefulWidget {
|
|
const ProfilePhoneScreen({super.key});
|
|
|
|
@override
|
|
State<ProfilePhoneScreen> createState() => _ProfilePhoneScreenState();
|
|
}
|
|
|
|
class _ProfilePhoneScreenState extends State<ProfilePhoneScreen> {
|
|
final TextEditingController _phoneController = TextEditingController();
|
|
|
|
@override
|
|
void dispose() {
|
|
_phoneController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<MyUserBloc, MyUserState>(
|
|
builder: (context, state) {
|
|
if (state.status == MyUserStatus.success) {
|
|
_phoneController.text = state.user!.phone ?? '';
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text(
|
|
_phoneController.text.isEmpty
|
|
? 'Agregar telefono'
|
|
: 'Actualizar telefono',
|
|
),
|
|
),
|
|
body: const Placeholder(),
|
|
);
|
|
} else {
|
|
return const Center(child: CircularProgressIndicator());
|
|
}
|
|
},
|
|
);
|
|
}
|
|
}
|