Skip to content

Commit

Permalink
宝具准备
Browse files Browse the repository at this point in the history
  • Loading branch information
toly1994328 committed Jul 7, 2023
1 parent b801827 commit b41dce7
Show file tree
Hide file tree
Showing 52 changed files with 2,214 additions and 481 deletions.
Binary file modified assets/iconfont/toly_icon.ttf
Binary file not shown.
30 changes: 19 additions & 11 deletions lib/app/navigation/pure_bottom_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:flutter/material.dart';

typedef IndexTapCallback = void Function(int);
typedef IndexLongTapCallback = void Function(BuildContext, int);

class PureBottomBar extends StatefulWidget {
final int initPosition;

Expand All @@ -11,33 +12,36 @@ class PureBottomBar extends StatefulWidget {

// item 长按事件
final IndexLongTapCallback? onItemLongTap;
const PureBottomBar({Key? key, this.onItemTap,this.onItemLongTap,this.initPosition=0}) : super(key: key);
const PureBottomBar(
{Key? key, this.onItemTap, this.onItemLongTap, this.initPosition = 0})
: super(key: key);

@override
State<PureBottomBar> createState() => _PureBottomBarState();
}

class _PureBottomBarState extends State<PureBottomBar> {
List<String> get bottomBar => const['组件','绘制', '收藏','我的'];
List<String> get bottomBar => const ['组件', '绘制',
// '宝具',
'收藏', '我的'];

List<IconData> get bottomBarIcon => const[
TolyIcon.icon_layout,
TolyIcon.dingzhi1,
List<IconData> get bottomBarIcon => const [
TolyIcon.icon_layout,
TolyIcon.dingzhi1,
// TolyIcon.icon_artifact,
TolyIcon.icon_collect,
TolyIcon.yonghu,
];
TolyIcon.yonghu,
];
int _position = 0;

@override
void initState() {
super.initState();
_position = widget.initPosition;

}

@override
Widget build(BuildContext context) {

return Wrap(
children: [
// Divider(height: 1,),
Expand All @@ -49,7 +53,6 @@ class _PureBottomBarState extends State<PureBottomBar> {

widget.onItemTap?.call(_position);
setState(() {

// _controller.jumpToPage(_position);
});
},
Expand All @@ -64,7 +67,12 @@ class _PureBottomBarState extends State<PureBottomBar> {
showUnselectedLabels: true,
showSelectedLabels: true,
// backgroundColor: themeColor.itemColor,
items: bottomBar.asMap().keys.map((index) => BottomNavigationBarItem(label: bottomBar[index], icon: Icon(bottomBarIcon[index]))).toList(),
items: bottomBar
.asMap()
.keys
.map((index) => BottomNavigationBarItem(
label: bottomBar[index], icon: Icon(bottomBarIcon[index])))
.toList(),
),
],
);
Expand Down
7 changes: 5 additions & 2 deletions lib/app/navigation/unit_navigation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:io';

import 'package:app/app.dart';
import 'package:app_update/app_update.dart';
import 'package:artifact/artifact.dart';
import 'package:authentication/authentication.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand All @@ -11,6 +12,7 @@ import 'package:flutter_unit/widget_ui/mobile/category_page/home_right_drawer.da
import 'package:widget_module/blocs/blocs.dart';
import 'package:flutter_unit/widget_ui/mobile/widget_panel/standard_home_page.dart';


import 'pure_bottom_bar.dart';
import 'desk_ui/unit_desk_navigation.dart';

Expand Down Expand Up @@ -76,6 +78,7 @@ class _UnitPhoneNavigationState extends State<UnitPhoneNavigation> {
children: [
StandardHomePage(),
GalleryUnit(),
// ArtifactPage(),
CollectPageAdapter(),
UserPage(),
],
Expand Down Expand Up @@ -114,7 +117,7 @@ class _UnitPhoneNavigationState extends State<UnitPhoneNavigation> {
}
}

if (index == 2) {
if (index == 3) {
BlocProvider.of<LikeWidgetBloc>(context).add(const EventLoadLikeData());
}
}
Expand All @@ -124,7 +127,7 @@ class _UnitPhoneNavigationState extends State<UnitPhoneNavigation> {
if (index == 0) {
Scaffold.of(context).openDrawer();
}
if (index == 3) {
if (index == 4) {
Scaffold.of(context).openEndDrawer();
}
}
Expand Down
30 changes: 18 additions & 12 deletions lib/code_gen/icon_font_gen/gen_message_action.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'package:app/app.dart';
import 'package:flutter/material.dart';



class GenMessageAction extends StatelessWidget {
final VoidCallback onGen;
const GenMessageAction({Key? key, required this.onGen}) : super(key: key);
Expand All @@ -12,21 +10,29 @@ class GenMessageAction extends StatelessWidget {
return Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: Text(
Expanded(
child: Text(
'使用方式:\n1. 在 iconfont.cn 挑选图标,加入项目,下载压缩包。\n2. 选择 Flutter 项目地址,配置资源、产物文件位置。\n3. 点击生成代码按钮,即可生成相关代码。',
style: TextStyle(
color: Theme.of(context).primaryColor,fontWeight: FontWeight.bold),)),
color: Theme.of(context).primaryColor,
fontWeight: FontWeight.bold),
)),
ElevatedButton(
style: ElevatedButton.styleFrom(
elevation: 0,
shape: const StadiumBorder()
),
onPressed:onGen, child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 4,
elevation: 0, shape: const StadiumBorder()),
onPressed: onGen,
child: Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 4,
children: [
Icon(TolyIcon.icon_fast,size: 16,),
const Text('生成代码',style: TextStyle(height: 1,fontSize: 12),),
Icon(
TolyIcon.icon_fast,
size: 16,
),
const Text(
'生成代码',
style: TextStyle(height: 1.1, fontSize: 12),
),
],
)),
],
Expand Down
34 changes: 0 additions & 34 deletions lib/code_gen/icon_font_gen/icon_font_class_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,38 +107,4 @@ class $fontFamily {
pubspecFile.writeAsStringSync(lines.join('\n'));
}
}

// // 修改 pubspec.yaml
// void setYaml(IconFontGenConfig config){
// String fontFamily = config.fontFamily;
// String assets = config.assetsDist.replaceAll('\\', '/');
//
// final String filePath = path.join(config.projectPath,'pubspec.yaml');
// File pubspecFile = File(filePath);
// final String pubspec = pubspecFile.readAsStringSync();
// final doc = loadYaml(pubspec);
// final modifiableDoc = getModifiableNode(doc);
//
// YamlList? fontsList = doc['flutter']['fonts'] as YamlList?;
// if(fontsList == null){
// // 新文件,没有配置 fonts 节点
// modifiableDoc['flutter']['fonts'] = YamlMap.wrap({
// 'family': fontFamily,
// 'fonts':YamlList.wrap([YamlMap.wrap({'asset':'$assets/iconfont.ttf'})])
// });
// }else{
// final modifiableList = getModifiableNode(fontsList);
// modifiableList.removeWhere((e) => e['family'] == fontFamily);
// modifiableList.add(
// YamlMap.wrap({
// 'family': fontFamily,
// 'fonts':YamlList.wrap([YamlMap.wrap({'asset':'$assets/iconfont.ttf'})])
// })
// );
// modifiableDoc['flutter']['fonts'] = modifiableList;
// }
// final targetYaml = toYamlString(modifiableDoc);
// pubspecFile.writeAsStringSync(targetYaml);
// }

}
1 change: 0 additions & 1 deletion lib/code_gen/icon_font_gen/icon_font_gen_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ class FileSelectorInput extends StatelessWidget {
}

void _showSelectFile() async {
print("=======_showSelectFile=============");
String? path;
if (pickerDir) {
path = await FilePicker.platform.getDirectoryPath();
Expand Down
22 changes: 17 additions & 5 deletions lib/widget_ui/mobile/widget_panel/standard_home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,23 @@ class _StandardHomePageState extends State<StandardHomePage>
child: NestedScrollView(
floatHeaderSlivers: true,
headerSliverBuilder: _buildHeader,
body: TabBarView(
physics: const NeverScrollableScrollPhysics(),
controller: tabController,
children: _tabs.map(buildScrollPage).toList(),
),
body: Builder(
builder:(ctx)=> CustomScrollView(
// key: PageStorageKey<String>(name),
slivers: <Widget>[
SliverOverlapInjector(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(ctx),
),
const WidgetListPanel(),
SliverPadding(
padding: const EdgeInsets.only(bottom: 30),
sliver: SliverOverlapInjector(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(ctx),
),
),
],
),
)
),
),
],
Expand Down
17 changes: 10 additions & 7 deletions lib/widget_ui/mobile/widget_panel/widget_model_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ class StandardWidgetItem extends StatelessWidget {
return Row(
children: [
if (searchArg == null)
Text(
model.name,
style: TextStyle(
fontSize: 16,
color: textColor,
fontWeight: FontWeight.bold,
Expanded(
child: Text(
model.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 16,
color: textColor,
fontWeight: FontWeight.bold,
),
),
),
if (searchArg != null) Text.rich(formSpan(model.name, searchArg!)),
Expand Down Expand Up @@ -85,7 +89,6 @@ class StandardWidgetItem extends StatelessWidget {
),
);
}),
const Spacer(),
StarScore(
star: Star(emptyColor: Colors.white, size: 12, fillColor: color),
score: model.lever,
Expand Down
3 changes: 2 additions & 1 deletion packages/app/lib/app/res/toly_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import 'package:flutter/widgets.dart';
// 欢迎支持: https://github.com/toly1994328/FlutterUnit
class TolyIcon {
TolyIcon._();
static const IconData dark = IconData(0xe72f, fontFamily: "TolyIcon");
static const IconData icon_artifact = IconData(0xe726, fontFamily: "TolyIcon");
static const IconData dark = IconData(0xe72f, fontFamily: "TolyIcon");
static const IconData wb_sunny = IconData(0xe746, fontFamily: "TolyIcon");
static const IconData icon_fast = IconData(0xe607, fontFamily: "TolyIcon");
static const IconData icon_layout = IconData(0xe85e, fontFamily: "TolyIcon");
Expand Down
12 changes: 9 additions & 3 deletions packages/app/lib/app/theme/app_theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ class AppTheme {
primaryColor: state.themeColor,
scaffoldBackgroundColor: Color(0xffF3F4F6),
useMaterial3: useMaterial3,
tabBarTheme: TabBarTheme(
dividerColor: Colors.transparent,
),
// Android 使用 Material3
chipTheme: ChipThemeData(padding: EdgeInsets.symmetric(horizontal: 10)),
listTileTheme: ListTileThemeData(
Expand All @@ -79,6 +76,15 @@ class AppTheme {
space: px1,
thickness: px1,
),
tabBarTheme: TabBarTheme(
dividerColor: Colors.transparent,
splashFactory: NoSplash.splashFactory,
overlayColor: MaterialStateProperty.resolveWith<Color?>(
(Set<MaterialState> states) {
return states.contains(MaterialState.focused) ? null : Colors.transparent;
},
),
),
bottomNavigationBarTheme: const BottomNavigationBarThemeData(
backgroundColor: Colors.white),
appBarTheme: AppBarTheme(
Expand Down
1 change: 1 addition & 0 deletions packages/app/lib/repository/app_state_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class AppStateRepository{
}

await FlutterDbStorage.instance.initDb();
await AppDbStorage.instance.initDb();


return AppState.fromPo(po);
Expand Down
3 changes: 1 addition & 2 deletions packages/app_update/lib/bloc/bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class UpdateBloc extends Bloc<UpdateEvent, UpdateState> {
emit(const CheckLoadingState());
// await Future.delayed(Duration(seconds: 1));
// 检测更新逻辑
TaskResult<AppInfo> result =
await AppInfoApi.getAppVersion(appName: event.appName);
TaskResult<AppInfo> result = await AppInfoApi.getAppVersion(appName: event.appName);
PackageInfo packageInfo = await PackageInfo.fromPlatform();

if (result.success && result.data != null) {
Expand Down
30 changes: 30 additions & 0 deletions packages/artifact/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
/pubspec.lock
**/doc/api/
.dart_tool/
.packages
build/
10 changes: 10 additions & 0 deletions packages/artifact/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: e3c29ec00c9c825c891d75054c63fcc46454dca1
channel: stable

project_type: package
3 changes: 3 additions & 0 deletions packages/artifact/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions packages/artifact/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
Loading

0 comments on commit b41dce7

Please sign in to comment.