Skip to content

Commit 9ce1ea2

Browse files
Update filter
1 parent e574f90 commit 9ce1ea2

74 files changed

Lines changed: 3308 additions & 1077 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

lib/Models/card_value.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,10 @@ class CardBindings {
181181
}
182182
}
183183

184+
bool hasCardType(CardBindingKeyEnum key) {
185+
return items.any((element) => element.key == key.key);
186+
}
187+
184188
ImageValue? getImageValue(CardBindingKeyEnum key) {
185189
List<CardBindingItem> imageItems = items
186190
.where((element) => element.type == DataType.IMAGE)

lib/Models/tab_item_data.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,11 @@ class TabItemDataList {
118118
return keyList[index].currentState as RefreshMixin?;
119119
}
120120

121+
ViewConfigMixin? getViewConfigMixin(int index) {
122+
if (index < 0 || index >= scrollControllerList.length) return null;
123+
return keyList[index].currentState as ViewConfigMixin?;
124+
}
125+
121126
OnSelectTopicMixin? getOnSelectTopicMixin(int index) {
122127
if (index < 0 || index >= scrollControllerList.length) return null;
123128
return keyList[index].currentState as OnSelectTopicMixin?;

lib/Models/view_config.dart

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2025 Robert-Stackflow.
3+
*
4+
* This program is free software: you can redistribute it and/or modify it under the terms of the
5+
* GNU General Public License as published by the Free Software Foundation, either version 3 of the
6+
* License, or (at your option) any later version.
7+
*
8+
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
9+
* even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
* GNU General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU General Public License along with this program.
13+
* If not, see <https://www.gnu.org/licenses/>.
14+
*/
15+
16+
class ViewConfig {
17+
bool containReplies;
18+
bool containRetweets;
19+
bool onlyShowMedia;
20+
21+
ViewConfig({
22+
this.containReplies = true,
23+
this.containRetweets = true,
24+
this.onlyShowMedia = false,
25+
});
26+
27+
factory ViewConfig.fromJson(Map<String, dynamic> json) {
28+
return ViewConfig(
29+
containReplies: json['containReplies'] ?? true,
30+
containRetweets: json['containRetweets'] ?? true,
31+
onlyShowMedia: json['onlyShowMedia'] ?? false,
32+
);
33+
}
34+
35+
Map<String, dynamic> toJson() {
36+
final Map<String, dynamic> data = <String, dynamic>{};
37+
data['containReplies'] = containReplies;
38+
data['containRetweets'] = containRetweets;
39+
data['onlyShowMedia'] = onlyShowMedia;
40+
return data;
41+
}
42+
43+
@override
44+
String toString() {
45+
return 'ViewConfig{containReplies: $containReplies, containRetweets: $containRetweets, onlyShowMedia: $onlyShowMedia}';
46+
}
47+
48+
bool get filtered =>
49+
containReplies != true ||
50+
containRetweets != true ||
51+
onlyShowMedia != false;
52+
}

lib/Resources/colors.dart

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
*/
1515

1616
import 'package:flutter/material.dart';
17+
import 'package:twitee/Resources/theme.dart';
1718

1819
import '../Utils/utils.dart';
1920
import '../Widgets/Window/window_button.dart';
@@ -98,9 +99,12 @@ class MyColors {
9899

99100
static const Color favoriteButtonColor = Color(0xFFFFD54F);
100101
static const Color shareButtonColor = Color(0xFF29B6F6);
101-
102102
static const Color likeButtonColor = Color(0xFFF06292);
103103

104+
static const Color starButtonColor = Color(0xFFf97316);
105+
static const Color unreadButtonColor = Color(0xFFff5c00);
106+
static const Color readLaterButtonColor = Color(0xff33b5e5);
107+
104108
static getStayOnTopButtonColors(BuildContext context) {
105109
return WindowButtonColors(
106110
normal: Theme.of(context).splashColor,
@@ -114,12 +118,13 @@ class MyColors {
114118

115119
static getNormalButtonColors(BuildContext context) {
116120
return WindowButtonColors(
121+
normal: Colors.transparent,
117122
mouseOver: Theme.of(context).splashColor,
118123
mouseDown: Theme.of(context).splashColor,
119124
iconNormal: Theme.of(context).iconTheme.color,
120125
iconMouseOver: Theme.of(context).iconTheme.color,
121126
iconMouseDown: Theme.of(context).iconTheme.color,
122-
selected: Theme.of(context).primaryColor.withAlpha(25),
127+
selected: MyTheme.primaryColor40,
123128
iconSelected: Theme.of(context).primaryColor,
124129
);
125130
}
@@ -138,8 +143,8 @@ class MyColors {
138143

139144
static getLinkColor(BuildContext context) {
140145
return Utils.currentBrightness(context) == Brightness.light
141-
? Colors.blue
142-
: Colors.blueAccent;
146+
? linkColor
147+
: linkColorDark;
143148
}
144149

145150
static getHotTagBackground(BuildContext context) {
@@ -153,26 +158,6 @@ class MyColors {
153158
? hotTagTextColor
154159
: hotTagTextColorDark;
155160
}
156-
157-
MaterialColor createMaterialColor(Color color) {
158-
List strengths = <double>[.05];
159-
Map<int, Color> swatch = {};
160-
final int r = color.red, g = color.green, b = color.blue;
161-
162-
for (int i = 1; i < 10; i++) {
163-
strengths.add(0.1 * i);
164-
}
165-
for (var strength in strengths) {
166-
final double ds = 0.5 - strength;
167-
swatch[(strength * 1000).round()] = Color.fromRGBO(
168-
r + ((ds < 0 ? r : (255 - r)) * ds).round(),
169-
g + ((ds < 0 ? g : (255 - g)) * ds).round(),
170-
b + ((ds < 0 ? b : (255 - b)) * ds).round(),
171-
1,
172-
);
173-
}
174-
return MaterialColor(color.value, swatch);
175-
}
176161
}
177162

178163
extension HexColor on Color {
@@ -184,8 +169,8 @@ extension HexColor on Color {
184169
}
185170

186171
String toHex({bool leadingHashSign = true}) => '${leadingHashSign ? '#' : ''}'
187-
'${alpha.toRadixString(16).padLeft(2, '0')}'
188-
'${red.toRadixString(16).padLeft(2, '0')}'
189-
'${green.toRadixString(16).padLeft(2, '0')}'
190-
'${blue.toRadixString(16).padLeft(2, '0')}';
172+
'${a.toInt().toRadixString(16).padLeft(2, '0')}'
173+
'${r.toInt().toRadixString(16).padLeft(2, '0')}'
174+
'${g.toInt().toRadixString(16).padLeft(2, '0')}'
175+
'${b.toInt().toRadixString(16).padLeft(2, '0')}';
191176
}

0 commit comments

Comments
 (0)