33 lines
1.2 KiB
Dart
33 lines
1.2 KiB
Dart
import 'package:finnow_app/api/profile.dart';
|
|
import 'package:finnow_app/main.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
/// A list item that shows a profile in the user's list of all profiles.
|
|
class ProfileListItem extends StatelessWidget {
|
|
final Profile profile;
|
|
const ProfileListItem(this.profile, {super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return GestureDetector(
|
|
onTap: () {
|
|
getIt<GoRouter>().go('/profiles/${profile.name}');
|
|
},
|
|
child: Container(
|
|
constraints: const BoxConstraints(maxWidth: 300),
|
|
padding: const EdgeInsets.all(10),
|
|
margin: const EdgeInsets.only(top: 10, bottom: 10),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(10), color: const Color.fromARGB(255, 168, 233, 170)),
|
|
child: Row(children: [
|
|
Expanded(child: Text(profile.name)),
|
|
TextButton(
|
|
onPressed: () {
|
|
print('Removing profile: ${profile.name}');
|
|
},
|
|
child: const Text('Remove'))
|
|
])));
|
|
}
|
|
}
|