|
| 1 | +import 'package:checks/checks.dart'; |
| 2 | +import 'package:flutter/widgets.dart'; |
| 3 | + |
| 4 | +import 'package:zulip/model/narrow.dart'; |
| 5 | +import 'package:zulip/widgets/channel_colors.dart'; |
| 6 | +import 'package:zulip/widgets/compose_box.dart'; |
| 7 | +import 'package:zulip/widgets/content.dart'; |
| 8 | +import 'package:zulip/widgets/message_list.dart'; |
| 9 | +import 'package:zulip/widgets/page.dart'; |
| 10 | +import 'package:zulip/widgets/profile.dart'; |
| 11 | +import 'package:zulip/widgets/store.dart'; |
| 12 | +import 'package:zulip/widgets/unread_count_badge.dart'; |
| 13 | + |
| 14 | +extension ChannelColorSwatchChecks on Subject<ChannelColorSwatch> { |
| 15 | + Subject<Color> get base => has((s) => s.base, 'base'); |
| 16 | + Subject<Color> get unreadCountBadgeBackground => has((s) => s.unreadCountBadgeBackground, 'unreadCountBadgeBackground'); |
| 17 | + Subject<Color> get iconOnPlainBackground => has((s) => s.iconOnPlainBackground, 'iconOnPlainBackground'); |
| 18 | + Subject<Color> get iconOnBarBackground => has((s) => s.iconOnBarBackground, 'iconOnBarBackground'); |
| 19 | + Subject<Color> get barBackground => has((s) => s.barBackground, 'barBackground'); |
| 20 | +} |
| 21 | + |
| 22 | +extension ComposeBoxStateChecks on Subject<ComposeBoxState> { |
| 23 | + Subject<ComposeBoxController> get controller => has((c) => c.controller, 'controller'); |
| 24 | +} |
| 25 | + |
| 26 | +extension ComposeBoxControllerChecks on Subject<ComposeBoxController> { |
| 27 | + Subject<ComposeContentController> get content => has((c) => c.content, 'content'); |
| 28 | + Subject<FocusNode> get contentFocusNode => has((c) => c.contentFocusNode, 'contentFocusNode'); |
| 29 | +} |
| 30 | + |
| 31 | +extension StreamComposeBoxControllerChecks on Subject<StreamComposeBoxController> { |
| 32 | + Subject<ComposeTopicController> get topic => has((c) => c.topic, 'topic'); |
| 33 | + Subject<FocusNode> get topicFocusNode => has((c) => c.topicFocusNode, 'topicFocusNode'); |
| 34 | +} |
| 35 | + |
| 36 | +extension EditMessageComposeBoxControllerChecks on Subject<EditMessageComposeBoxController> { |
| 37 | + Subject<int> get messageId => has((c) => c.messageId, 'messageId'); |
| 38 | + Subject<String?> get originalRawContent => has((c) => c.originalRawContent, 'originalRawContent'); |
| 39 | +} |
| 40 | + |
| 41 | +extension ComposeContentControllerChecks on Subject<ComposeContentController> { |
| 42 | + Subject<List<ContentValidationError>> get validationErrors => has((c) => c.validationErrors, 'validationErrors'); |
| 43 | +} |
| 44 | + |
| 45 | +extension RealmContentNetworkImageChecks on Subject<RealmContentNetworkImage> { |
| 46 | + Subject<Uri> get src => has((i) => i.src, 'src'); |
| 47 | + // TODO others |
| 48 | +} |
| 49 | + |
| 50 | +extension AvatarImageChecks on Subject<AvatarImage> { |
| 51 | + Subject<int> get userId => has((i) => i.userId, 'userId'); |
| 52 | +} |
| 53 | + |
| 54 | +extension AvatarShapeChecks on Subject<AvatarShape> { |
| 55 | + Subject<double> get size => has((i) => i.size, 'size'); |
| 56 | + Subject<double> get borderRadius => has((i) => i.borderRadius, 'borderRadius'); |
| 57 | + Subject<Widget> get child => has((i) => i.child, 'child'); |
| 58 | +} |
| 59 | + |
| 60 | +extension MessageListPageChecks on Subject<MessageListPage> { |
| 61 | + Subject<Narrow> get initNarrow => has((x) => x.initNarrow, 'initNarrow'); |
| 62 | + Subject<int?> get initAnchorMessageId => has((x) => x.initAnchorMessageId, 'initAnchorMessageId'); |
| 63 | +} |
| 64 | + |
| 65 | +extension WidgetRouteChecks<T> on Subject<WidgetRoute<T>> { |
| 66 | + Subject<Widget> get page => has((x) => x.page, 'page'); |
| 67 | +} |
| 68 | + |
| 69 | +extension AccountRouteChecks<T> on Subject<AccountRoute<T>> { |
| 70 | + Subject<int> get accountId => has((x) => x.accountId, 'accountId'); |
| 71 | +} |
| 72 | + |
| 73 | +extension ProfilePageChecks on Subject<ProfilePage> { |
| 74 | + Subject<int> get userId => has((x) => x.userId, 'userId'); |
| 75 | +} |
| 76 | + |
| 77 | +extension PerAccountStoreWidgetChecks on Subject<PerAccountStoreWidget> { |
| 78 | + Subject<int> get accountId => has((x) => x.accountId, 'accountId'); |
| 79 | + Subject<Widget> get child => has((x) => x.child, 'child'); |
| 80 | +} |
| 81 | + |
| 82 | +extension UnreadCountBadgeChecks on Subject<UnreadCountBadge> { |
| 83 | + Subject<int> get count => has((b) => b.count, 'count'); |
| 84 | + Subject<bool> get bold => has((b) => b.bold, 'bold'); |
| 85 | + Subject<Color?> get backgroundColor => has((b) => b.backgroundColor, 'backgroundColor'); |
| 86 | +} |
0 commit comments