mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-24 07:00:47 -04:00
accept via paste
This commit is contained in:
parent
7496a1a2a7
commit
8bb8285e50
27 changed files with 829 additions and 324 deletions
|
@ -1,54 +1,75 @@
|
|||
import 'package:awesome_extensions/awesome_extensions.dart';
|
||||
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:flutter_translate/flutter_translate.dart';
|
||||
import 'package:searchable_listview/searchable_listview.dart';
|
||||
|
||||
import '../../entities/proto.dart' as proto;
|
||||
import '../tools/tools.dart';
|
||||
import 'contact_invitation_item_widget.dart';
|
||||
import 'contact_item_widget.dart';
|
||||
import 'empty_contact_list_widget.dart';
|
||||
|
||||
class ContactInvitationListWidget extends ConsumerWidget {
|
||||
const ContactInvitationListWidget(
|
||||
{required this.contactInvitationRecordList, super.key});
|
||||
class ContactInvitationListWidget extends ConsumerStatefulWidget {
|
||||
ContactInvitationListWidget({
|
||||
required this.contactInvitationRecordList,
|
||||
super.key,
|
||||
});
|
||||
|
||||
final IList<proto.ContactInvitationRecord> contactInvitationRecordList;
|
||||
|
||||
@override
|
||||
ContactInvitationListWidgetState createState() =>
|
||||
ContactInvitationListWidgetState();
|
||||
}
|
||||
|
||||
class ContactInvitationListWidgetState
|
||||
extends ConsumerState<ContactInvitationListWidget> {
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
// ignore: prefer_expression_function_bodies
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final textTheme = theme.textTheme;
|
||||
//final scale = theme.extension<ScaleScheme>()!;
|
||||
//final textTheme = theme.textTheme;
|
||||
final scale = theme.extension<ScaleScheme>()!;
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
width: double.infinity,
|
||||
constraints: const BoxConstraints(minHeight: 64, maxHeight: 200),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Contacts',
|
||||
style: textTheme.bodyMedium,
|
||||
),
|
||||
ListView.builder(itemBuilder: (context, index) {
|
||||
if (index < 0 || index >= contactInvitationRecordList.length) {
|
||||
return null;
|
||||
}
|
||||
return ContactInvitationItemWidget(
|
||||
contactInvitationRecord: contactInvitationRecordList[index],
|
||||
key: ObjectKey(contactInvitationRecordList[index]));
|
||||
}, findChildIndexCallback: (key) {
|
||||
final index = contactInvitationRecordList.indexOf(
|
||||
(key as ObjectKey).value! as proto.ContactInvitationRecord);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
}
|
||||
return index;
|
||||
})
|
||||
Container(
|
||||
width: double.infinity,
|
||||
decoration: ShapeDecoration(
|
||||
color: scale.grayScale.appBackground,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
)),
|
||||
child: ListView.builder(
|
||||
controller: _scrollController,
|
||||
itemCount: widget.contactInvitationRecordList.length,
|
||||
itemBuilder: (context, index) {
|
||||
if (index < 0 ||
|
||||
index >= widget.contactInvitationRecordList.length) {
|
||||
return null;
|
||||
}
|
||||
return ContactInvitationItemWidget(
|
||||
contactInvitationRecord:
|
||||
widget.contactInvitationRecordList[index],
|
||||
key: ObjectKey(
|
||||
widget.contactInvitationRecordList[index]))
|
||||
.paddingAll(2);
|
||||
},
|
||||
findChildIndexCallback: (key) {
|
||||
final index = widget.contactInvitationRecordList.indexOf(
|
||||
(key as ObjectKey).value!
|
||||
as proto.ContactInvitationRecord);
|
||||
if (index == -1) {
|
||||
return null;
|
||||
}
|
||||
return index;
|
||||
},
|
||||
shrinkWrap: true,
|
||||
)).paddingLTRB(8, 0, 8, 8).flexible()
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue