Merge branch 'pangea-merge' of https://github.com/pangeachat/client into pangea-merge
This commit is contained in:
commit
194b12d500
4 changed files with 140 additions and 80 deletions
|
|
@ -1,10 +1,3 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pages/chat_details/chat_details.dart';
|
||||
import 'package:fluffychat/pages/chat_details/participant_list_item.dart';
|
||||
|
|
@ -26,6 +19,11 @@ import 'package:fluffychat/widgets/avatar.dart';
|
|||
import 'package:fluffychat/widgets/chat_settings_popup_menu.dart';
|
||||
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
class ChatDetailsView extends StatelessWidget {
|
||||
final ChatDetailsController controller;
|
||||
|
|
@ -546,8 +544,10 @@ class ChatDetailsView extends StatelessWidget {
|
|||
backgroundColor:
|
||||
Theme.of(context).scaffoldBackgroundColor,
|
||||
foregroundColor: iconColor,
|
||||
child: const Icon(
|
||||
Icons.lock_outlined,
|
||||
child: Icon(
|
||||
room.locked
|
||||
? Icons.lock_outlined
|
||||
: Icons.no_encryption_outlined,
|
||||
),
|
||||
),
|
||||
value: room.locked,
|
||||
|
|
|
|||
|
|
@ -1,11 +1,10 @@
|
|||
// Flutter imports:
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import 'package:fluffychat/pangea/utils/password_forgotten.dart';
|
||||
import 'package:fluffychat/widgets/layouts/login_scaffold.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
import 'login.dart';
|
||||
|
||||
class LoginView extends StatelessWidget {
|
||||
|
|
@ -20,7 +19,30 @@ class LoginView extends StatelessWidget {
|
|||
// enforceMobileMode: Matrix.of(context).client.isLogged(),
|
||||
// Pangea#
|
||||
appBar: AppBar(
|
||||
leading: controller.loading ? null : const BackButton(),
|
||||
// #Pangea
|
||||
// leading: controller.loading ? null : const BackButton(),
|
||||
leading: controller.loading
|
||||
? null
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: ElevatedButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
style: ButtonStyle(
|
||||
padding: MaterialStateProperty.all(EdgeInsets.zero),
|
||||
backgroundColor: MaterialStateProperty.all<Color>(
|
||||
Theme.of(context)
|
||||
.colorScheme
|
||||
.background
|
||||
.withOpacity(0.75),
|
||||
),
|
||||
shape: MaterialStateProperty.all<OutlinedBorder>(
|
||||
const CircleBorder(),
|
||||
),
|
||||
),
|
||||
child: const Icon(Icons.arrow_back),
|
||||
),
|
||||
),
|
||||
// Pangea#
|
||||
automaticallyImplyLeading: !controller.loading,
|
||||
centerTitle: true,
|
||||
// #Pangea
|
||||
|
|
|
|||
|
|
@ -1,13 +1,13 @@
|
|||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fl_chart/fl_chart.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:fluffychat/config/themes.dart';
|
||||
import 'package:fluffychat/pangea/pages/analytics/bar_chart_placeholder_data.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../enum/time_span.dart';
|
||||
import '../../enum/use_type.dart';
|
||||
import '../../models/chart_analytics_model.dart';
|
||||
|
|
@ -102,39 +102,73 @@ class MessagesBarChartState extends State<MessagesBarChart> {
|
|||
);
|
||||
}
|
||||
|
||||
bool showLabelBasedOnTimeSpan(
|
||||
TimeSpan timeSpan,
|
||||
TimeSeriesInterval current,
|
||||
TimeSeriesInterval? last,
|
||||
int labelIndex,
|
||||
) {
|
||||
switch (timeSpan) {
|
||||
case TimeSpan.day:
|
||||
return current.end.hour % 3 == 0;
|
||||
case TimeSpan.month:
|
||||
if (current.end.month != last?.end.month) {
|
||||
return true;
|
||||
}
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
if (FluffyThemes.isColumnMode(context)) {
|
||||
width = width - FluffyThemes.navRailWidth - FluffyThemes.columnWidth;
|
||||
}
|
||||
const int numDays = 28;
|
||||
const int minSpacePerDay = 20;
|
||||
final int availableSpaces = width ~/ minSpacePerDay;
|
||||
final int showAtInterval = (numDays / availableSpaces).floor() + 1;
|
||||
|
||||
final int lastDayOfCurrentMonth =
|
||||
DateTime(current.end.year, current.end.month + 1, 0).day;
|
||||
final bool isNextToMonth = labelIndex == 1 ||
|
||||
current.end.day == 2 ||
|
||||
current.end.day == lastDayOfCurrentMonth;
|
||||
final bool shouldShowNextToMonth = showAtInterval <= 1;
|
||||
return (current.end.day % showAtInterval == 0) &&
|
||||
(!isNextToMonth || shouldShowNextToMonth);
|
||||
case TimeSpan.week:
|
||||
case TimeSpan.sixmonths:
|
||||
case TimeSpan.year:
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
String getLabelBasedOnTimeSpan(
|
||||
TimeSpan timeSpan,
|
||||
TimeSeriesInterval current,
|
||||
TimeSeriesInterval? last,
|
||||
int labelIndex,
|
||||
) {
|
||||
if (widget.chartAnalytics == null) {
|
||||
final bool showLabel = showLabelBasedOnTimeSpan(
|
||||
timeSpan,
|
||||
current,
|
||||
last,
|
||||
labelIndex,
|
||||
);
|
||||
|
||||
if (widget.chartAnalytics == null || !showLabel) {
|
||||
return "";
|
||||
}
|
||||
if (isInSameGroup(last, current, timeSpan)) {
|
||||
return "-";
|
||||
}
|
||||
|
||||
switch (widget.chartAnalytics?.timeSpan ?? TimeSpan.month) {
|
||||
case TimeSpan.day:
|
||||
return current.end.hour % 3 == 0
|
||||
? DateFormat(DateFormat.HOUR).format(current.end)
|
||||
: "";
|
||||
// return current.end.hour.toString();
|
||||
return DateFormat(DateFormat.HOUR).format(current.end);
|
||||
case TimeSpan.week:
|
||||
return DateFormat(DateFormat.ABBR_WEEKDAY).format(current.end);
|
||||
case TimeSpan.month:
|
||||
// return current.end.month != last?.end.month
|
||||
// ? DateFormat(DateFormat.ABBR_MONTH_DAY).format(current.end)
|
||||
// : current.end.day % 5 == 0 &&
|
||||
// labelIndex != 1 &&
|
||||
// current.end.day != 30
|
||||
// ? DateFormat(DateFormat.DAY).format(current.end)
|
||||
// : "'";
|
||||
return current.end.month != last?.end.month
|
||||
? DateFormat(DateFormat.ABBR_MONTH).format(current.end)
|
||||
: DateFormat(DateFormat.DAY).format(current.end);
|
||||
// return current.end.day.toString();
|
||||
// text = DateFormat('DAY').format(timeSeriesIntervalStart);
|
||||
case TimeSpan.sixmonths:
|
||||
case TimeSpan.year:
|
||||
return DateFormat(DateFormat.ABBR_STANDALONE_MONTH).format(current.end);
|
||||
|
|
|
|||
|
|
@ -1,15 +1,12 @@
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/extensions/pangea_room_extension.dart';
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import '../../../widgets/matrix.dart';
|
||||
import '../../utils/firebase_analytics.dart';
|
||||
import 'add_class_and_invite.dart';
|
||||
|
|
@ -192,24 +189,49 @@ class AddToSpaceState extends State<AddToSpaceToggles> {
|
|||
),
|
||||
),
|
||||
),
|
||||
if (parents.any((r) => r.room.id == possibleParent.id))
|
||||
SwitchListTile.adaptive(
|
||||
title: Text(
|
||||
L10n.of(context)!.suggestTo(possibleParentName),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
subtitle: Text(
|
||||
widget.mode == AddToClassMode.chat
|
||||
? L10n.of(context)!.suggestChatDesc(possibleParentName)
|
||||
: L10n.of(context)!.suggestExchangeDesc(possibleParentName),
|
||||
),
|
||||
activeColor: AppConfig.activeToggleColor,
|
||||
value: isSuggestedInSpace(possibleParent),
|
||||
onChanged: (bool suggest) =>
|
||||
setSuggested(suggest, possibleParent),
|
||||
),
|
||||
AnimatedSize(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
child: parents.any((r) => r.room.id == possibleParent.id)
|
||||
? SwitchListTile.adaptive(
|
||||
title: Row(
|
||||
children: [
|
||||
const SizedBox(width: 32),
|
||||
Text(
|
||||
L10n.of(context)!.suggestTo(possibleParentName),
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: Row(
|
||||
children: [
|
||||
const SizedBox(width: 32),
|
||||
Expanded(
|
||||
child: Text(
|
||||
widget.mode == AddToClassMode.chat
|
||||
? L10n.of(context)!
|
||||
.suggestChatDesc(possibleParentName)
|
||||
: L10n.of(context)!.suggestExchangeDesc(
|
||||
possibleParentName,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
activeColor: AppConfig.activeToggleColor,
|
||||
value: isSuggestedInSpace(possibleParent),
|
||||
onChanged: (bool suggest) =>
|
||||
setSuggested(suggest, possibleParent),
|
||||
)
|
||||
: Container(),
|
||||
),
|
||||
Divider(
|
||||
height: 0.5,
|
||||
color: Theme.of(context).colorScheme.secondary.withAlpha(25),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
@ -223,7 +245,6 @@ class AddToSpaceState extends State<AddToSpaceToggles> {
|
|||
final String subtitle = widget.mode == AddToClassMode.exchange
|
||||
? L10n.of(context)!.addToClassDesc
|
||||
: L10n.of(context)!.addToClassOrExchangeDesc;
|
||||
final scrollController = ScrollController();
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
|
|
@ -253,27 +274,10 @@ class AddToSpaceState extends State<AddToSpaceToggles> {
|
|||
if (isOpen) ...[
|
||||
const Divider(height: 1),
|
||||
possibleParents.isNotEmpty
|
||||
? Scrollbar(
|
||||
controller: scrollController,
|
||||
thumbVisibility: true,
|
||||
child: SingleChildScrollView(
|
||||
controller: scrollController,
|
||||
child: Column(
|
||||
children: [
|
||||
const Divider(height: 1),
|
||||
SizedBox(
|
||||
height: min(possibleParents.length * 55, 500),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: possibleParents.length,
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
return getAddToSpaceToggleItem(i);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
? Column(
|
||||
children: possibleParents
|
||||
.mapIndexed((index, _) => getAddToSpaceToggleItem(index))
|
||||
.toList(),
|
||||
)
|
||||
: Center(
|
||||
child: Padding(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue