mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 04:49:21 +00:00
Fix a few notices
This commit is contained in:
parent
06312512a6
commit
45e8f34c81
@ -199,11 +199,8 @@ class ConversationMessage extends SerializableElement<ConversationMessage> {
|
||||
required this.message,
|
||||
required this.file,
|
||||
required this.serverMessage,
|
||||
}) : assert(id != null),
|
||||
assert(convID != null),
|
||||
assert(userID != null || serverMessage != null),
|
||||
assert(timeSent != null),
|
||||
assert(message != null || file != null || serverMessage != null);
|
||||
}) : assert(userID != null || serverMessage != null),
|
||||
assert(!message.isNull || file != null || serverMessage != null);
|
||||
|
||||
DateTime get date => DateTime.fromMillisecondsSinceEpoch(timeSent! * 1000);
|
||||
|
||||
|
@ -9,6 +9,5 @@ class CountUnreadNotifications {
|
||||
CountUnreadNotifications({
|
||||
required int this.notifications,
|
||||
required int this.conversations,
|
||||
}) : assert(notifications != null),
|
||||
assert(conversations != null);
|
||||
});
|
||||
}
|
||||
|
@ -16,8 +16,7 @@ class GroupMembershipWidget extends StatefulWidget {
|
||||
final Function()? onError;
|
||||
|
||||
const GroupMembershipWidget(
|
||||
{required this.group, this.onUpdated, this.onError})
|
||||
: assert(group != null);
|
||||
{required this.group, this.onUpdated, this.onError});
|
||||
|
||||
@override
|
||||
_GroupMembershipWidgetState createState() => _GroupMembershipWidgetState();
|
||||
@ -120,7 +119,8 @@ class _GroupMembershipWidgetState extends SafeState<GroupMembershipWidget> {
|
||||
/// Cancel group membership request
|
||||
void _cancelRequest() async {
|
||||
if (!await GroupsHelper().cancelRequest(_id)) {
|
||||
showSimpleSnack(context, tr("Could not cancel your membership request!")!);
|
||||
showSimpleSnack(
|
||||
context, tr("Could not cancel your membership request!")!);
|
||||
if (this.widget.onError != null) this.widget.onError!();
|
||||
} else {
|
||||
// Refresh state
|
||||
|
@ -18,10 +18,7 @@ class IconButtonWithBadge extends StatelessWidget {
|
||||
required this.onPressed,
|
||||
this.number = 0,
|
||||
this.active = false,
|
||||
}) : assert(icon != null),
|
||||
assert(number != null),
|
||||
assert(active != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -45,10 +45,7 @@ class _MenuItem {
|
||||
required this.action,
|
||||
required this.pageType,
|
||||
this.isMenu = false,
|
||||
}) : assert(label != null),
|
||||
assert(isMenu != null),
|
||||
assert(isMenu || icon != null),
|
||||
assert(isMenu || action != null),
|
||||
}) : assert(isMenu || action != null),
|
||||
assert(isMenu || pageType != null);
|
||||
}
|
||||
|
||||
@ -57,9 +54,7 @@ class _ActionMenuItem {
|
||||
final String label;
|
||||
final BarCallbackActions action;
|
||||
|
||||
const _ActionMenuItem({required this.label, required this.action})
|
||||
: assert(label != null),
|
||||
assert(action != null);
|
||||
const _ActionMenuItem({required this.label, required this.action});
|
||||
}
|
||||
|
||||
/// List of menu items to show
|
||||
@ -113,8 +108,7 @@ class ComunicMobileAppBar extends StatefulWidget
|
||||
const ComunicMobileAppBar({
|
||||
Key? key,
|
||||
required this.currentPage,
|
||||
}) : assert(currentPage != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ComunicMobileAppBarState createState() => _ComunicMobileAppBarState();
|
||||
@ -154,8 +148,6 @@ class _ComunicMobileAppBarState extends SafeState<ComunicMobileAppBar> {
|
||||
|
||||
/// Get the number of unread notifications for the selected notice
|
||||
int? getNumberUnread(BarCallbackActions? action) {
|
||||
if (_unreadNotifications == null) return 0;
|
||||
|
||||
switch (action) {
|
||||
case BarCallbackActions.OPEN_NOTIFICATIONS:
|
||||
return _unreadNotifications.notifications;
|
||||
|
@ -19,9 +19,7 @@ class UserMobilePage extends StatefulWidget {
|
||||
Key? key,
|
||||
required this.userInfo,
|
||||
required this.onNeedRefresh,
|
||||
}) : assert(userInfo != null),
|
||||
assert(onNeedRefresh != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_UserMobilePageState createState() => _UserMobilePageState();
|
||||
@ -114,9 +112,7 @@ class UserPageTab {
|
||||
required this.label,
|
||||
required this.onBuild,
|
||||
this.visible = true,
|
||||
}) : assert(label != null),
|
||||
assert(onBuild != null),
|
||||
assert(visible != null);
|
||||
});
|
||||
|
||||
Tab get tab => Tab(text: label);
|
||||
}
|
||||
|
@ -26,9 +26,7 @@ class NetworkImageWidget extends StatelessWidget {
|
||||
this.height,
|
||||
this.roundedEdges = true,
|
||||
this.loadingHeight,
|
||||
}) : assert(url != null),
|
||||
assert(allowFullScreen != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
double? get _loadingHeight => loadingHeight != null ? loadingHeight : height;
|
||||
|
||||
|
@ -36,9 +36,7 @@ class NewPasswordInputWidget extends StatefulWidget {
|
||||
this.textInputAction,
|
||||
required this.label,
|
||||
required this.user,
|
||||
}) : assert(label != null),
|
||||
assert(user != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
NewPasswordInputWidgetState createState() => NewPasswordInputWidgetState();
|
||||
|
@ -29,11 +29,7 @@ class PickUserWidget extends StatefulWidget {
|
||||
this.keepFocusOnChoose = false,
|
||||
this.onValueChange,
|
||||
this.enabled = true,
|
||||
}) : assert(onSelectUser != null),
|
||||
assert(label != null),
|
||||
assert(resetOnChoose != null),
|
||||
assert(keepFocusOnChoose != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() => _PickUserWidgetState();
|
||||
|
@ -35,9 +35,7 @@ class PostCreateFormWidget extends StatefulWidget {
|
||||
required this.postTarget,
|
||||
required this.targetID,
|
||||
required this.onCreated,
|
||||
}) : assert(postTarget != null),
|
||||
assert(targetID != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_PostCreateFormWidgetState createState() => _PostCreateFormWidgetState();
|
||||
@ -403,10 +401,7 @@ class _PostOptionWidget extends StatelessWidget {
|
||||
required this.selected,
|
||||
required this.onTap,
|
||||
this.customColor})
|
||||
: assert(icon != null),
|
||||
assert(selected != null),
|
||||
assert(onTap != null),
|
||||
super(key: key);
|
||||
: super(key: key);
|
||||
|
||||
bool get hasCustomColor => customColor != null;
|
||||
|
||||
|
@ -14,7 +14,7 @@ bool _defaultCheck(String s) => s.isNotEmpty;
|
||||
class TextEditSettingsTile extends SettingsTile {
|
||||
final String title;
|
||||
final String currValue;
|
||||
final void Function(String) onChanged;
|
||||
final void Function(String)? onChanged;
|
||||
final bool Function(String) checkInput;
|
||||
final bool allowEmptyValues;
|
||||
final int maxLines;
|
||||
@ -31,11 +31,7 @@ class TextEditSettingsTile extends SettingsTile {
|
||||
this.allowEmptyValues = false,
|
||||
this.maxLength,
|
||||
this.maxLines = 1,
|
||||
}) : assert(title != null),
|
||||
assert(currValue != null),
|
||||
assert(checkInput != null),
|
||||
assert(allowEmptyValues != null),
|
||||
assert(maxLines != null);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -64,6 +60,6 @@ class TextEditSettingsTile extends SettingsTile {
|
||||
|
||||
if (value == null) return;
|
||||
|
||||
onChanged(value);
|
||||
onChanged!(value);
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,7 @@ class SurveyWidget extends StatefulWidget {
|
||||
Key? key,
|
||||
required this.survey,
|
||||
required this.onUpdated,
|
||||
}) : assert(survey != null),
|
||||
assert(onUpdated != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SurveyWidgetState createState() => _SurveyWidgetState();
|
||||
@ -202,7 +200,8 @@ class _SurveyWidgetState extends SafeState<SurveyWidget> {
|
||||
try {
|
||||
if (!await showConfirmDialog(
|
||||
context: context,
|
||||
message: tr("Do you really want to block new choices creation?"))) return;
|
||||
message: tr("Do you really want to block new choices creation?")))
|
||||
return;
|
||||
|
||||
await SurveyHelper.blockNewChoicesCreation(survey.postID);
|
||||
|
||||
|
@ -4,8 +4,7 @@ class TabTransitionWidget extends StatefulWidget {
|
||||
final Widget child;
|
||||
|
||||
const TabTransitionWidget(this.child, {Key? key})
|
||||
: assert(child != null),
|
||||
super(key: key);
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_TabTransitionWidgetState createState() => _TabTransitionWidgetState();
|
||||
|
@ -18,10 +18,7 @@ class AppBarCustomDropDownWidget extends StatefulWidget {
|
||||
required this.icon,
|
||||
required this.notificationsBadge,
|
||||
required this.onBuildOverlay,
|
||||
}) : assert(icon != null),
|
||||
assert(notificationsBadge != null),
|
||||
assert(onBuildOverlay != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
AppBarCustomDropDownWidgetState createState() =>
|
||||
|
@ -18,9 +18,7 @@ class CallWindowWidget extends StatefulWidget {
|
||||
Key? key,
|
||||
required this.convID,
|
||||
required this.onClose,
|
||||
}) : assert(convID != null),
|
||||
assert(onClose != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CallWindowWidgetState createState() => _CallWindowWidgetState();
|
||||
|
@ -27,9 +27,7 @@ class ConversationWindow extends StatefulWidget {
|
||||
Key? key,
|
||||
required this.convID,
|
||||
required this.onClose,
|
||||
}) : assert(convID != null),
|
||||
assert(onClose != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_ConversationWindowState createState() => _ConversationWindowState();
|
||||
@ -59,10 +57,8 @@ class _ConversationWindowState extends SafeState<ConversationWindow> {
|
||||
|
||||
final conversation =
|
||||
await ConversationsHelper().getSingle(_convID, force: true);
|
||||
assert(conversation != null);
|
||||
final name =
|
||||
await ConversationsHelper.getConversationNameAsync(conversation);
|
||||
assert(name != null);
|
||||
|
||||
setState(() {
|
||||
_conversation = conversation;
|
||||
|
@ -27,12 +27,7 @@ class ConversationWindowContainer extends StatelessWidget {
|
||||
required this.onToggleCollapse,
|
||||
required this.isCollapsed,
|
||||
this.action,
|
||||
}) : assert(title != null),
|
||||
assert(onClose != null),
|
||||
assert(body != null),
|
||||
assert(onToggleCollapse != null),
|
||||
assert(isCollapsed != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -147,8 +147,7 @@ class _SearchResultsWidget extends StatelessWidget {
|
||||
Key? key,
|
||||
required this.results,
|
||||
required this.onTap,
|
||||
}) : assert(onTap != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -31,8 +31,7 @@ class MembershipsPanel extends StatefulWidget {
|
||||
const MembershipsPanel({
|
||||
Key? key,
|
||||
required this.currentPage,
|
||||
}) : assert(currentPage != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MembershipsPanelState createState() => _MembershipsPanelState();
|
||||
|
@ -139,9 +139,7 @@ class _MainMenuItem extends PopupMenuEntry<_MenuItemCallback> {
|
||||
required this.label,
|
||||
required this.icon,
|
||||
required this.onTap,
|
||||
}) : assert(label != null),
|
||||
assert(icon != null),
|
||||
assert(onTap != null);
|
||||
});
|
||||
|
||||
@override
|
||||
__MainMenuItemState createState() => __MainMenuItemState();
|
||||
|
@ -31,9 +31,7 @@ class UserPageTablet extends StatefulWidget {
|
||||
required this.userInfo,
|
||||
required this.friendshipStatus,
|
||||
required this.onNeedRefresh,
|
||||
}) : assert(userInfo != null),
|
||||
assert(onNeedRefresh != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_UserPageTabletState createState() => _UserPageTabletState();
|
||||
|
@ -24,10 +24,7 @@ class TextWidget extends StatelessWidget {
|
||||
this.textAlign = TextAlign.start,
|
||||
this.style,
|
||||
this.linksColor = Colors.blueAccent,
|
||||
}) : assert(content != null),
|
||||
assert(parseBBcode != null),
|
||||
assert(linksColor != null),
|
||||
super(key: key);
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -18,8 +18,7 @@ class TourNotificationsPane extends PresentationPane {
|
||||
required Function() onConfigured,
|
||||
required Function() onChanged,
|
||||
required bool visible,
|
||||
}) : assert(pushNotificationsKey != null),
|
||||
super(
|
||||
}) : super(
|
||||
icon: Icons.notifications,
|
||||
title: tr("Push notifications")!,
|
||||
child: (c) => PushNotificationsConfigurationWidget(
|
||||
|
@ -13,8 +13,7 @@ class BBCodeParsedWidget extends StatelessWidget {
|
||||
final ParseCallBack? parseCallback;
|
||||
|
||||
BBCodeParsedWidget({required String text, this.parseCallback})
|
||||
: assert(text != null),
|
||||
_content = _parse(text);
|
||||
: _content = _parse(text);
|
||||
|
||||
_printRecur(_Element el, {int pos = 0}) {
|
||||
String str;
|
||||
@ -239,7 +238,7 @@ class _Element {
|
||||
if (parseCallback != null && text != null) {
|
||||
final parsed = parseCallback(generatedStyle, text);
|
||||
|
||||
if (parsed != null && parsed.length > 0)
|
||||
if (parsed.length > 0)
|
||||
return TextSpan(
|
||||
style: generatedStyle,
|
||||
children: parsed,
|
||||
|
@ -16,9 +16,6 @@ void popPage(BuildContext context) {
|
||||
|
||||
/// Open the page of a user
|
||||
void openUserPage({required int userID, required BuildContext context}) {
|
||||
assert(userID != null);
|
||||
assert(context != null);
|
||||
|
||||
MainController.of(context)!.openUserPage(userID);
|
||||
}
|
||||
|
||||
|
@ -101,13 +101,6 @@ Future<String?> askUserString({
|
||||
int maxLength = 200,
|
||||
int minLength = 1,
|
||||
}) async {
|
||||
assert(context != null);
|
||||
assert(title != null);
|
||||
assert(message != null);
|
||||
assert(defaultValue != null);
|
||||
assert(hint != null);
|
||||
assert(maxLength != null);
|
||||
|
||||
TextEditingController controller = TextEditingController(text: defaultValue);
|
||||
|
||||
final confirm = await showDialog<bool>(
|
||||
@ -257,7 +250,8 @@ const darkAccentColor = Colors.white70;
|
||||
const darkerAccentColor = Colors.white30;
|
||||
|
||||
/// Check out whether dark theme is enabled or not
|
||||
bool darkTheme() => preferences()!.getBool(PreferencesKeyList.ENABLE_DARK_THEME);
|
||||
bool darkTheme() =>
|
||||
preferences()!.getBool(PreferencesKeyList.ENABLE_DARK_THEME);
|
||||
|
||||
/// Check out whether we use tablet mode or not
|
||||
bool isTablet(BuildContext context) =>
|
||||
|
Loading…
Reference in New Issue
Block a user