diff --git a/lib/providers/call.dart b/lib/providers/call.dart index db2a2fc..2903f01 100644 --- a/lib/providers/call.dart +++ b/lib/providers/call.dart @@ -2,7 +2,6 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; -import 'package:get/get_rx/get_rx.dart'; import 'package:livekit_client/livekit_client.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:solian/models/call.dart'; diff --git a/lib/screens/account/friend.dart b/lib/screens/account/friend.dart index 6607e0f..4fca818 100644 --- a/lib/screens/account/friend.dart +++ b/lib/screens/account/friend.dart @@ -1,9 +1,9 @@ import 'package:flutter/material.dart'; -import 'package:flutter_animate/flutter_animate.dart'; import 'package:get/get.dart'; import 'package:solian/exts.dart'; import 'package:solian/models/relations.dart'; import 'package:solian/providers/relation.dart'; +import 'package:solian/theme.dart'; import 'package:solian/widgets/account/relative_list.dart'; class FriendScreen extends StatefulWidget { @@ -21,15 +21,15 @@ class _FriendScreenState extends State List _relations = List.empty(); - List filterByStatus(int status) { + List _filterByStatus(int status) { return _relations.where((x) => x.status == status).toList(); } - Future loadRelations() async { + Future _loadRelations() async { setState(() => _isBusy = true); - final RelationshipProvider provider = Get.find(); - final resp = await provider.listRelation(); + final RelationshipProvider relations = Get.find(); + final resp = await relations.listRelation(); setState(() { _relations = resp.body @@ -104,8 +104,8 @@ class _FriendScreenState extends State super.initState(); _tabController = TabController(length: 3, vsync: this); - loadRelations().then((_) { - if (filterByStatus(0).isEmpty) { + _loadRelations().then((_) { + if (_filterByStatus(0).isEmpty) { _tabController.animateTo(1); } }); @@ -119,6 +119,19 @@ class _FriendScreenState extends State appBar: AppBar( centerTitle: false, title: Text('accountFriend'.tr), + actions: [ + if (_isBusy) + SizedBox( + height: 48, + width: 48, + child: const CircularProgressIndicator( + strokeWidth: 3, + ).paddingAll(14), + ), + SizedBox( + width: SolianTheme.isLargeScreen(context) ? 8 : 16, + ), + ], bottom: TabBar( controller: _tabController, tabs: const [ @@ -136,46 +149,34 @@ class _FriendScreenState extends State controller: _tabController, children: [ RefreshIndicator( - onRefresh: () => loadRelations(), + onRefresh: () => _loadRelations(), child: CustomScrollView( slivers: [ - if (_isBusy) - SliverToBoxAdapter( - child: const LinearProgressIndicator().animate().scaleX(), - ), SilverRelativeList( - items: filterByStatus(0), - onUpdate: () => loadRelations(), + items: _filterByStatus(0), + onUpdate: () => _loadRelations(), ), ], ), ), RefreshIndicator( - onRefresh: () => loadRelations(), + onRefresh: () => _loadRelations(), child: CustomScrollView( slivers: [ - if (_isBusy) - SliverToBoxAdapter( - child: const LinearProgressIndicator().animate().scaleX(), - ), SilverRelativeList( - items: filterByStatus(1), - onUpdate: () => loadRelations(), + items: _filterByStatus(1), + onUpdate: () => _loadRelations(), ), ], ), ), RefreshIndicator( - onRefresh: () => loadRelations(), + onRefresh: () => _loadRelations(), child: CustomScrollView( slivers: [ - if (_isBusy) - SliverToBoxAdapter( - child: const LinearProgressIndicator().animate().scaleX(), - ), SilverRelativeList( - items: filterByStatus(3), - onUpdate: () => loadRelations(), + items: _filterByStatus(3), + onUpdate: () => _loadRelations(), ), ], ), diff --git a/lib/widgets/attachments/attachment_list.dart b/lib/widgets/attachments/attachment_list.dart index 8ccad1e..51afe3a 100644 --- a/lib/widgets/attachments/attachment_list.dart +++ b/lib/widgets/attachments/attachment_list.dart @@ -58,6 +58,7 @@ class _AttachmentListState extends State { _attachmentsMeta = result; _isLoading = false; }); + _calculateAspectRatio(); }); }