added edit_contact screen and functions icons
This commit is contained in:
@@ -2,6 +2,7 @@ import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart';
|
||||
import 'package:functions/src/features/contacts/presentation/edit_contact_screen.dart';
|
||||
import 'package:functions/src/features/contacts/presentation/state/contacts_view_model.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
@@ -35,18 +36,18 @@ class ContactsScreen extends ConsumerWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
IconButton(onPressed: () {Navigator.pop(context);},
|
||||
icon: Icon(Icons.arrow_back)),
|
||||
icon: Icon(Icons.arrow_back)),
|
||||
if (!state.isEditing) ...[
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF588EA5),
|
||||
shape: BoxShape.circle
|
||||
color: Color(0xFF588EA5),
|
||||
shape: BoxShape.circle
|
||||
),
|
||||
child: IconButton(onPressed: vm.toggleIsEditing,
|
||||
icon: Icon(Icons.edit_outlined,
|
||||
color: Colors.white,
|
||||
size: SizeUtils.getByScreen(small: 30, big: 28),
|
||||
)
|
||||
icon: Icon(Icons.edit_outlined,
|
||||
color: Colors.white,
|
||||
size: SizeUtils.getByScreen(small: 30, big: 28),
|
||||
)
|
||||
),
|
||||
)
|
||||
]
|
||||
@@ -86,7 +87,20 @@ class ContactsScreen extends ConsumerWidget {
|
||||
big: EdgeInsets.symmetric(horizontal: 24, vertical: 12)
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Color(0xFF588EA5),
|
||||
),
|
||||
width: SizeUtils.getByScreen(small: 48, big: 46),
|
||||
child: CustomTextButton(
|
||||
onPressed: (){},
|
||||
text: '+',
|
||||
color: Colors.white,
|
||||
size: SizeUtils.getByScreen(small: 48, big: 47),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
@@ -204,6 +218,27 @@ class ContactCard extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(width: SizeUtils.getByScreen(small: 16, big: 14)),
|
||||
DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFF588EA5),
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
child:
|
||||
IconButton(
|
||||
onPressed: (){Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => EditContactScreen(
|
||||
contact: contact,
|
||||
/*navigationContract: navigationContract*/
|
||||
)),
|
||||
);},
|
||||
icon: Icon(
|
||||
Icons.edit_outlined,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
]
|
||||
],
|
||||
),
|
||||
|
||||
@@ -0,0 +1,136 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart';
|
||||
import 'package:functions/src/features/contacts/presentation/state/contacts_view_model.dart';
|
||||
// import 'package:navigation/navigation.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:utils/utils.dart';
|
||||
|
||||
class EditContactScreen extends ConsumerWidget {
|
||||
//final NavigationContract navigationContract;
|
||||
final ListContactEntity contact;
|
||||
|
||||
const EditContactScreen({super.key, required this.contact
|
||||
// required this.navigationContract
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final vm = ref.read(contactsViewModelProvider.notifier);
|
||||
// final state = ref.watch(linkedDevicesViewModelProvider);
|
||||
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
|
||||
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
IconButton(onPressed: () {Navigator.pop(context);},
|
||||
icon: Icon(Icons.arrow_back)),
|
||||
Center(
|
||||
child: Text(context.translate('Edit Contact'),
|
||||
style: TextStyle(
|
||||
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
|
||||
),
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
|
||||
Expanded(child: Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(horizontal: 48, vertical: 10),
|
||||
big: EdgeInsets.symmetric(horizontal: 47, vertical: 8)
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
Center(child: SvgPicture.asset('assets/images/ui/profile.svg')),
|
||||
Center(child: SizedBox(
|
||||
width: 160,
|
||||
height: 160,
|
||||
child: Align(alignment: Alignment.bottomRight,
|
||||
child: IconButton(
|
||||
onPressed: (){},
|
||||
icon: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Color(0xFFCAC9C9)
|
||||
),
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Icon(
|
||||
Icons.edit_outlined,
|
||||
color: Colors.white,
|
||||
size: SizeUtils.getByScreen(small: 32, big: 30),
|
||||
),
|
||||
),
|
||||
)
|
||||
)
|
||||
))
|
||||
],
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
|
||||
CustomTextField(
|
||||
controller: vm.nameController,
|
||||
hint: contact.name,
|
||||
label: context.translate(I18n.legacyName),
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 28, big: 26)),
|
||||
Stack(
|
||||
children: [
|
||||
CustomTextField(
|
||||
controller: vm.phoneController,
|
||||
keyboardType: TextInputType.number,
|
||||
hint: contact.phone,
|
||||
label: context.translate('Phone number'),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: IconButton(
|
||||
onPressed: (){},
|
||||
icon: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Color(0xFF588EA5)
|
||||
),
|
||||
child: Icon(
|
||||
SFIcons.contactsCircle,
|
||||
color: Colors.white,
|
||||
)
|
||||
)
|
||||
),
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
PrimaryButton(
|
||||
onPressed: (){vm.updateContact(contact);},
|
||||
text: context.translate(I18n.legacySave),
|
||||
color: Color(0xFF588EA5)
|
||||
)
|
||||
],
|
||||
))
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart';
|
||||
import 'package:functions/src/features/contacts/domain/entities/list_contact_entity.dart';
|
||||
import 'package:functions/src/features/contacts/domain/get_contacts_use_case.dart';
|
||||
import 'package:functions/src/features/contacts/presentation/providers/get_contacts_provider.dart';
|
||||
import 'package:functions/src/features/contacts/presentation/state/contacts_view_state.dart';
|
||||
@@ -15,14 +16,17 @@ class ContactsViewModel extends Notifier<ContactsViewState> {
|
||||
late final GetContactsUseCase _getContactsUseCase;
|
||||
|
||||
late final TextEditingController nameController;
|
||||
late final TextEditingController phoneController;
|
||||
|
||||
@override
|
||||
ContactsViewState build() {
|
||||
_getContactsUseCase = ref.read(getContactsUseCaseProvider);
|
||||
|
||||
nameController = TextEditingController();
|
||||
phoneController = TextEditingController();
|
||||
|
||||
nameController.addListener(_onNameChanged);
|
||||
phoneController.addListener(_onPhoneChanged);
|
||||
|
||||
_getContactsUseCase.getContacts(deviceId: '').then(setContacts);
|
||||
|
||||
@@ -48,9 +52,20 @@ class ContactsViewModel extends Notifier<ContactsViewState> {
|
||||
state = state.copyWith(name: text, errorMessage: '');
|
||||
}
|
||||
|
||||
void _onPhoneChanged() {
|
||||
final text = phoneController.text;
|
||||
if (text == state.phone) return;
|
||||
|
||||
state = state.copyWith(phone: text, errorMessage: '');
|
||||
}
|
||||
|
||||
void updateContact(ListContactEntity contact) {}
|
||||
|
||||
void disposeControllers() {
|
||||
nameController.removeListener(_onNameChanged);
|
||||
phoneController.removeListener(_onPhoneChanged);
|
||||
|
||||
nameController.dispose();
|
||||
phoneController.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,67 +48,67 @@ class FunctionsScreen extends ConsumerWidget {
|
||||
children: [
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.menu,
|
||||
icon: SFIcons.connection,
|
||||
text: 'Remote connection'
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.menu,
|
||||
icon: SFIcons.calendarCircle,
|
||||
text: 'Calendar'
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){navigationContract.pushTo(AppRoutes.contacts);},
|
||||
icon: Icons.menu,
|
||||
icon: SFIcons.contactsCircle,
|
||||
text: 'Contacts'
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.menu,
|
||||
icon: SFIcons.doNotDisturbCircle,
|
||||
text: 'Do not disturb'
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.menu,
|
||||
icon: SFIcons.locationAreaCircle,
|
||||
text: 'Safety zone'
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.menu,
|
||||
icon: SFIcons.videoCallCircle,
|
||||
text: 'Video call'
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.menu,
|
||||
icon: SFIcons.fallCircle,
|
||||
text: 'Fall notice'
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.menu,
|
||||
icon: SFIcons.medicationCircle,
|
||||
text: 'Medication reminder'
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.menu,
|
||||
icon: SFIcons.activityCircle,
|
||||
text: 'Activity meter'
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.menu,
|
||||
icon: SFIcons.rewardsCircle,
|
||||
text: 'Rewards'
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: Icons.menu,
|
||||
icon: SFIcons.locateSfCircle,
|
||||
text: 'Locate your SaveFamily'
|
||||
),
|
||||
],
|
||||
@@ -153,12 +153,12 @@ class AppSectionButton extends ConsumerWidget {
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: Color(0xFF588EA5),
|
||||
),
|
||||
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)),
|
||||
child: Icon(icon,
|
||||
size: SizeUtils.getByScreen(small: 40, big: 44),
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
),
|
||||
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 0, big: 0)),
|
||||
child: Icon(icon,
|
||||
size: SizeUtils.getByScreen(small: 52, big: 48),
|
||||
color: Color(0xFF588EA5),
|
||||
weight: 30,
|
||||
),
|
||||
),
|
||||
|
||||
@@ -51,7 +51,7 @@ class LegacyDashboardScreen extends ConsumerWidget {
|
||||
label: context.translate(I18n.location),
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.chat_outlined),
|
||||
icon: Icon(SFIcons.chat),
|
||||
label: context.translate(I18n.chat),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user