-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
147 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ MioFeed - Modern RSS reader | |
- [x] 更新订阅 | ||
- [x] 删除订阅 | ||
- [x] 获取订阅 | ||
- [x] 时间排序 | ||
- [ ] 主题功能 | ||
- [ ] 订阅分组 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import 'package:flutter/material.dart' as md; | ||
|
||
class Color { | ||
/// 根据字符串生成一个颜色 | ||
/// [string] 字符串 | ||
static md.Color stringToColor(String string) { | ||
string = string.length > 20 ? string.substring(0, 20) : string; | ||
|
||
int hash = 0; | ||
for (int i = 0; i < string.length; i++) { | ||
hash = string.codeUnitAt(i) + ((hash << 5) - hash); | ||
} | ||
|
||
String colorString = '#'; | ||
for (int i = 0; i < 3; i++) { | ||
int value = (hash >> (i * 8)) & 0xFF; | ||
colorString += value.toRadixString(16).padLeft(2, '0'); | ||
} | ||
|
||
return md.Color( | ||
int.parse(colorString.substring(1), radix: 16) + 0xFF000000, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:miofeed/utils/color.dart' as color_utils; | ||
|
||
class ParagraphUtils { | ||
static Widget buildColorIcon(String subName) { | ||
return Container( | ||
color: color_utils.Color.stringToColor(subName), | ||
child: Center(child: Text(subName.substring(0, 1))), | ||
); | ||
} | ||
} |