Skip to content

Commit

Permalink
DEV UPDATE:Add member filter
Browse files Browse the repository at this point in the history
  • Loading branch information
misakajimmy committed Jan 14, 2023
1 parent 7dc8037 commit f67a153
Show file tree
Hide file tree
Showing 23 changed files with 434 additions and 171 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 33
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

Expand Down
57 changes: 27 additions & 30 deletions lib/common/Global.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:convert';

import 'package:eoe_fans/models/eoeTheme.dart';
import 'package:eoe_fans/models/memberMap.dart';
import 'package:eoe_fans/models/member.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';

Expand All @@ -14,79 +14,76 @@ const _themes = <dynamic>[
'id': 'zao',
'name': 'zao',
'assetsPath': 'zao',
'filter': 'emoji/gogo队.webp'
},
{
'id': 'wan',
'name': 'wan',
'assetsPath': 'zao',
},
{
'id': 'mo',
'name': 'mo',
'assetsPath': 'zao',
},
{
'id': 'un',
'name': 'un',
'assetsPath': 'zao',
},
{
'id': 'mi',
'name': 'mi',
'assetsPath': 'zao',
}
{'id': 'wan', 'name': 'wan', 'assetsPath': 'wan', 'filter': 'emoji/小莞熊.webp'},
{'id': 'mo', 'name': 'mo', 'assetsPath': 'mo', 'filter': 'emoji/美人虞.webp'},
{'id': 'un', 'name': 'un', 'assetsPath': 'un', 'filter': 'emoji/柚恩蜜.webp'},
{'id': 'mi', 'name': 'mi', 'assetsPath': 'mi', 'filter': 'emoji/酷诺米.webp'}
];

const Map<String, dynamic> membersJson = {
'zao': {
const Map<MemberEnum, dynamic> membersJson = {
MemberEnum.zao: {
'key': 'zao',
'lastName': '白',
'firstName': '露早',
'bilibiliName': '露早GOGO',
'bilibiliUID': 1669777785,
'nickNames': ['早早'],
'color': '#3DFF9E',
},
'wan': {
MemberEnum.wan: {
'key': 'wan',
'lastName': '唐',
'firstName': '莞儿',
'bilibiliName': '莞儿睡不醒',
'bilibiliUID': 1875044092,
'nickNames': [''],
'nickNames': ['莞莞'],
'color': '#1EAFE4',
},
'mo': {
MemberEnum.mo: {
'key': 'mo',
'lastName': '苏',
'firstName': '虞莫',
'bilibiliName': '虞莫MOMO',
'bilibiliUID': 1811071010,
'nickNames': ['莫莫'],
'color': '#B77FDD',
},
'un': {
MemberEnum.un: {
'key': 'un',
'lastName': '姜',
'firstName': '柚恩',
'bilibiliName': '柚恩不加糖',
'bilibiliUID': 1795147802,
'nickNames': ['柚柚'],
'color': '#EB6346',
},
'mi': {
MemberEnum.mi: {
'key': 'mi',
'lastName': '安',
'firstName': '米诺',
'bilibiliName': '米诺高分少女',
'bilibiliUID': 1778026586,
'nickNames': ['大米'],
'color': '#F068B0',
}
};

class Global {
static late SharedPreferences _prefs;
static Profile profile = Profile();
static MemberMap members = MemberMap.fromJson(membersJson);

static Map<MemberEnum, Member> get members => membersJson.map((key, value) => MapEntry(key, Member.fromJson(value)));

//网络缓存对象
static NetCache netCache = NetCache();

static String currentTheme = 'zao';

//可选主题列表
static List<EoeTheme> get themes => _themes.map((e) => EoeTheme.fromJson(e)).toList();
static List<EoeTheme> get themes =>
_themes.map((e) => EoeTheme.fromJson(e)).toList();

//是否为release版
static bool get isRelease => bool.fromEnvironment("dart.vm.product");
Expand Down
14 changes: 7 additions & 7 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ import 'dart:io';

import 'package:eoe_fans/routes/mainPage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:eoe_fans/states/ProfileChangeNotifier.dart';
import 'package:flutter/services.dart';
import 'package:provider/provider.dart';

import 'common/Global.dart';

void main() {
WidgetsFlutterBinding.ensureInitialized();
// if (Platform.isAndroid) {
// // 以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。
// SystemUiOverlayStyle systemUiOverlayStyle =
// SystemUiOverlayStyle(statusBarColor: Colors.transparent);
// SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
// }
if (Platform.isAndroid) {
// 以下两行 设置android状态栏为透明的沉浸。写在组件渲染之后,是为了在渲染后进行set赋值,覆盖状态栏,写在渲染之前MaterialApp组件会覆盖掉这个值。
SystemUiOverlayStyle systemUiOverlayStyle =
SystemUiOverlayStyle(statusBarColor: Colors.transparent);
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
}
Global.init().then((e) => runApp(MyApp()));
}

Expand Down
3 changes: 2 additions & 1 deletion lib/models/eoeTheme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ part 'eoeTheme.g.dart';

@JsonSerializable()
class EoeTheme {
EoeTheme({required this.id, required this.name, required this.assetsPath});
EoeTheme({required this.id, required this.name, required this.assetsPath,required this.filter});

String id;
String name;
String assetsPath;
String filter;

factory EoeTheme.fromJson(Map<String, dynamic> json) =>
_$EoeThemeFromJson(json);
Expand Down
2 changes: 2 additions & 0 deletions lib/models/eoeTheme.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/models/index.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export 'cacheConfig.dart' ;
export 'video.dart' ;
export 'videos.dart' ;
export 'video.dart' ;
19 changes: 17 additions & 2 deletions lib/models/member.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,31 @@ import 'package:json_annotation/json_annotation.dart';

part 'member.g.dart';

enum MemberEnum {
@JsonValue("zao")
zao,
@JsonValue("wan")
wan,
@JsonValue("mi")
mi,
@JsonValue("un")
un,
@JsonValue("mo")
mo,
}

@JsonSerializable()
class Member {
Member(this.lastName, this.firstName, this.bilibiliName, this.bilibiliUID,
this.nickNames);
Member(this.key ,this.lastName, this.firstName, this.bilibiliName, this.bilibiliUID,
this.nickNames, this.color);

String key;
String lastName;
String firstName;
String bilibiliName;
num bilibiliUID;
List<String> nickNames;
String color;

factory Member.fromJson(Map<String, dynamic> json) => _$MemberFromJson(json);

Expand Down
4 changes: 4 additions & 0 deletions lib/models/member.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 0 additions & 29 deletions lib/models/memberMap.dart

This file was deleted.

27 changes: 0 additions & 27 deletions lib/models/memberMap.g.dart

This file was deleted.

16 changes: 16 additions & 0 deletions lib/models/theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:flutter/material.dart';

part 'theme.g.dart';

@JsonSerializable()
class Theme {
Theme();

late String themeName;
// late ThemeData themeData;

factory Theme.fromJson(Map<String, dynamic> json) => _$ThemeFromJson(json);

Map<String, dynamic> toJson() => _$ThemeToJson(this);
}
14 changes: 14 additions & 0 deletions lib/models/theme.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f67a153

Please sign in to comment.