added analytics view to space view, removed number ticker animation
This commit is contained in:
parent
4278f7b196
commit
15c2d1dfd9
3 changed files with 19 additions and 49 deletions
|
|
@ -11,6 +11,7 @@ import 'package:fluffychat/pangea/constants/pangea_room_types.dart';
|
|||
import 'package:fluffychat/pangea/extensions/pangea_room_extension/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/utils/chat_list_handle_space_tap.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:fluffychat/pangea/widgets/chat_list/analytics_summary/learning_progress_indicators.dart';
|
||||
import 'package:fluffychat/pangea/widgets/chat_list/chat_list_header_wrapper.dart';
|
||||
import 'package:fluffychat/pangea/widgets/chat_list/chat_list_item_wrapper.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
|
|
@ -733,6 +734,11 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
// #Pangea
|
||||
// ChatListHeader(controller: widget.controller),
|
||||
ChatListHeaderWrapper(controller: widget.controller),
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[const LearningProgressIndicators()],
|
||||
),
|
||||
),
|
||||
// Pangea#
|
||||
SliverList(
|
||||
delegate: SliverChildBuilderDelegate(
|
||||
|
|
@ -819,6 +825,11 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
controller: widget.controller,
|
||||
globalSearch: false,
|
||||
),
|
||||
SliverList(
|
||||
delegate: SliverChildListDelegate(
|
||||
[const LearningProgressIndicators()],
|
||||
),
|
||||
),
|
||||
// Pangea#
|
||||
SliverAppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
|
|
|
|||
|
|
@ -50,9 +50,13 @@ class MyAnalyticsController extends BaseController {
|
|||
|
||||
// Wait for the next sync in the stream to ensure that the pangea controller
|
||||
// is fully initialized. It will throw an error if it is not.
|
||||
_pangeaController.matrixState.client.onSync.stream.first.then((_) {
|
||||
if (_pangeaController.matrixState.client.prevBatch == null) {
|
||||
_pangeaController.matrixState.client.onSync.stream.first.then(
|
||||
(_) => _refreshAnalyticsIfOutdated(),
|
||||
);
|
||||
} else {
|
||||
_refreshAnalyticsIfOutdated();
|
||||
});
|
||||
}
|
||||
|
||||
// Listen to a stream that provides the eventIDs
|
||||
// of new messages sent by the logged in user
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:fluffychat/config/themes.dart';
|
||||
import 'package:fluffychat/pangea/enum/progress_indicators_enum.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
|
@ -36,8 +35,8 @@ class ProgressIndicatorBadge extends StatelessWidget {
|
|||
),
|
||||
const SizedBox(width: 5),
|
||||
!loading
|
||||
? AnimatedCount(
|
||||
count: points ?? 0,
|
||||
? Text(
|
||||
points?.toString() ?? '0',
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
|
@ -58,47 +57,3 @@ class ProgressIndicatorBadge extends StatelessWidget {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AnimatedCount extends ImplicitlyAnimatedWidget {
|
||||
const AnimatedCount({
|
||||
super.key,
|
||||
required this.count,
|
||||
this.style,
|
||||
super.duration = const Duration(seconds: 1),
|
||||
super.curve = FluffyThemes.animationCurve,
|
||||
});
|
||||
|
||||
final int count;
|
||||
final TextStyle? style;
|
||||
|
||||
@override
|
||||
ImplicitlyAnimatedWidgetState<ImplicitlyAnimatedWidget> createState() {
|
||||
return _AnimatedCountState();
|
||||
}
|
||||
}
|
||||
|
||||
class _AnimatedCountState extends AnimatedWidgetBaseState<AnimatedCount> {
|
||||
IntTween _intCount = IntTween(begin: 0, end: 1);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_intCount = IntTween(begin: 0, end: widget.count.toInt());
|
||||
controller.forward();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final String text = _intCount.evaluate(animation).toString();
|
||||
return Text(text, style: widget.style);
|
||||
}
|
||||
|
||||
@override
|
||||
void forEachTween(TweenVisitor<dynamic> visitor) {
|
||||
_intCount = visitor(
|
||||
_intCount,
|
||||
widget.count,
|
||||
(dynamic value) => IntTween(begin: value),
|
||||
) as IntTween;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue