bladeofgod / bedrock Goto Github PK
View Code? Open in Web Editor NEW一款基于MVVM+Provider的快速开发框架。
Home Page: https://juejin.im/post/5edc91edf265da76c76b18a5
一款基于MVVM+Provider的快速开发框架。
Home Page: https://juejin.im/post/5edc91edf265da76c76b18a5
插件版本旧,不能使用插件新特性
如 flutter_screenutil库
看到这个功能的更新:ExceptionBinding,使viewModel可以对内部的所有api接口的异常捕获
目前我的view model实现了ExceptionBinding的notifyException方法以及监听者注册,但是看了框架代码之后,没发现在什么地方来调用注册的监听。麻烦能不能解释一下?谢谢了大佬!!
注:
1.只在exception_pitcher.dart中看到view model InitData()的异常状态捕获
2.未看到其他地方对非initData()的api异常监听回调使用
suggest:
make loading widget global, such as EasyLoading
/C:/Users/js03/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/dokit-0.8.0-nullsafety.0/lib/engine/dokit_binding.dart:128:12: Error: The method 'setMockMessageHandler' isn't defined for the class 'BinaryMessenger'.
The plugins flutter_custom_dialog, launch_review, open_file, share
use a deprecated version of the Android embedding.
To avoid unexpected runtime failures, or future build failures, try to see if these plugins support the Android V2 embedding. Otherwise, consider removing them since a future release of Flutter will remove these deprecated APIs.
If you are plugin author, take a look at the docs for migrating the plugin to the V2 embedding: https://flutter.dev/go/android-plugin-migration.
Launching lib/main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Error: Cannot run with sound null safety, because the following dependencies
don't support null safety:
For solutions, see https://dart.dev/go/unsound-null-safety
../../../.pub-cache/hosted/pub.flutter-io.cn/dokit-0.8.0-nullsafety.0/lib/engine/dokit_binding.dart:128:12: Error: The method 'setMockMessageHandler' isn't defined for the class 'BinaryMessenger'.
'BinaryMessenger' is from 'package:flutter/src/services/binary_messenger.dart' ('../../flutter/packages/flutter/lib/src/services/binary_messenger.dart').
Try correcting the name to the name of an existing method, or defining a method named 'setMockMessageHandler'.
origin.setMockMessageHandler(channel, handler);
^^^^^^^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.flutter-io.cn/dokit-0.8.0-nullsafety.0/lib/engine/dokit_binding.dart:138:52: Error: The argument type 'Future<ByteData?>? Function(ByteData?)?' can't be assigned to the parameter type 'Future<ByteData?>? Function(ByteData?)' because 'Future<ByteData?>? Function(ByteData?)?' is nullable and 'Future<ByteData?>? Function(ByteData?)' isn't.
'Future' is from 'dart:async'.
'ByteData' is from 'dart:typed_data'.
return origin.checkMockMessageHandler(channel, handler);
^
../../../.pub-cache/hosted/pub.flutter-io.cn/pull_to_refresh-1.6.5/lib/src/internals/indicator_wrap.dart:632:9: Error: A value of type 'ValueNotifier' can't be assigned to a variable of type 'ValueNotifier'.
'ValueNotifier' is from 'package:flutter/src/foundation/change_notifier.dart' ('../../flutter/packages/flutter/lib/src/foundation/change_notifier.dart').
? refresher.controller.headerMode
^
../../../.pub-cache/hosted/pub.flutter-io.cn/dokit-0.8.0-nullsafety.0/lib/engine/dokit_http.dart:77:27: Error: A value of type 'Future Function(Uri, String, String)?' can't be assigned to a variable of type 'Future Function(Uri, String, String?)?' because 'String?' is nullable and 'String' isn't.
'Future' is from 'dart:async'.
'Uri' is from 'dart:core'.
origin.authenticate = f;
^
../../../.pub-cache/hosted/pub.flutter-io.cn/dokit-0.8.0-nullsafety.0/lib/engine/dokit_http.dart:84:32: Error: A value of type 'Future Function(String, int, String, String)?' can't be assigned to a variable of type 'Future Function(String, int, String, String?)?' because 'String?' is nullable and 'String' isn't.
'Future' is from 'dart:async'.
origin.authenticateProxy = f;
^
*********************************************************
WARNING: This version of share will break your Android build if it or its dependencies aren't compatible with AndroidX.
See https://goo.gl/CP92wY for more information on the problem and how to fix it.
This warning prints for all Android build failures. The real root cause of the error may be unrelated.
*********************************************************
FAILURE: Build failed with an exception.
Where:
Script '/Users/wanghong/Documents/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1005
What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command '/Users/wanghong/Documents/flutter/bin/flutter'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 15s
Exception: Gradle task assembleDebug failed with exit code 1
项目无法启动
flutter Invalid
Podfile file: no implicit conversion of nil into String
请问项目还需要怎么配置吗?网上的方案都试过了,始终无法运行。
flutter的版本是稳定版,还是beta版
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bedrock/base_framework/widget_state/base_state.dart';
import 'package:flutter_bedrock/base_framework/widget_state/page_state.dart';
import 'package:flutter_bedrock/page/demo_page/main/first_page.dart';
import 'package:flutter_bedrock/page/demo_page/main/second_page.dart';
import 'package:flutter_bedrock/page/demo_page/main/third_page.dart';
import 'package:oktoast/oktoast.dart';
import 'first_page.dart';
import 'second_page.dart';
typedef TransportScrollController = Function(ScrollController controller);
List itemList() {
return [
BottomNavigationBarItem(
title: Text("首页"),
// activeIcon: Image.asset(TKImages.tabbar_home_select, fit: BoxFit.contain),
// icon: Image.asset(TKImages.tabbar_home_unselect, fit: BoxFit.contain)
icon: Icon(Icons.home),
),
BottomNavigationBarItem(
title: Text("动态"),
// activeIcon: Image.asset(TKImages.tabbar_find_select, fit: BoxFit.contain),
// icon: Image.asset(TKImages.tabbar_find_unselect, fit: BoxFit.contain)
icon: Icon(Icons.insert_invitation),
),
BottomNavigationBarItem(
title: Container(),
// icon: Image.asset(TKImages.tabbar_add, fit: BoxFit.contain),
icon: Icon(
Icons.add_circle,
size: 44,
),
),
BottomNavigationBarItem(
title: Text("消息"),
// activeIcon: Image.asset(TKImages.tabbar_school_select, fit: BoxFit.contain),
// icon: Image.asset(TKImages.tabbar_school_unselect, fit: BoxFit.contain)
icon: Icon(Icons.chrome_reader_mode),
),
BottomNavigationBarItem(
title: Text("我的"),
// activeIcon: Image.asset(TKImages.tabbar_mine_select, fit: BoxFit.contain),
// icon: Image.asset(TKImages.tabbar_mine_unselect, fit: BoxFit.contain)
icon: Icon(Icons.person),
),
];
}
class MainPageState1 extends PageState {
final PageController pageController = PageController();
int selectIndex = 0;
ScrollController firstController;
DateTime lastPress;
jumpByIndex(int index) {
pageController.jumpToPage(index);
}
@OverRide
void initState() {
// TODO: implement initState
super.initState();
}
int _currentIndex = 0;
final List pageList = [
// FindPage(),
FirstPageState(null).generateWidget(),
SecondPageState().generateWidget(),
SecondPageState().generateWidget(),
SecondPageState().generateWidget(),
];
@OverRide
Widget build(BuildContext context) {
return switchStatusBar2Dark(
isSetDark: true,
child: Container(
color: Colors.white,
width: getWidthPx(750),
height: getHeightPx(1334),
child: Scaffold(
body: IndexedStack(
index: _currentIndex,
children: pageList,
),
bottomNavigationBar: BottomNavigationBar(
backgroundColor: Colors.red,
items: itemList(),
type: BottomNavigationBarType.fixed,
currentIndex: _currentIndex,
selectedFontSize: 10,
unselectedFontSize: 10,
selectedIconTheme: IconThemeData(
size: 24,
),
unselectedIconTheme: IconThemeData(size: 24),
onTap: (index) {
if (index == 2) {}
setState(() {
_currentIndex = index;
});
},
),
),
));
}
Widget normalIcon(IconData iconData) {
return Icon(
iconData,
color: Colors.grey,
);
}
Widget activeIcon(IconData iconData) {
return Icon(
iconData,
color: Colors.blue,
);
}
Widget buildBottomItem({
int index,
Icon icon,
Icon iconActive,
}) {
return GestureDetector(
onTap: () {
if (selectIndex != index) {
pageController.jumpToPage(index);
} else if (selectIndex == 0) {
firstController?.animateTo(0,
duration: Duration(microseconds: 500), curve: Curves.easeIn);
}
},
child: Container(
width: getWidthPx(80),
height: getWidthPx(80),
child: selectIndex == index ? iconActive : icon,
),
);
}
}
报错信息如下
════════ Exception caught by rendering library ═════════════════════════════════
Each child must be laid out exactly once.
The relevant error-causing widget was
Scaffold
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.20.0-1.0.pre.57, on Microsoft Windows [Version 10.0.18363.900], locale zh-CN)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses
[✓] Visual Studio - develop for Windows (Visual Studio Community 2019 16.7.0 Preview 2.0)
[✓] Android Studio (version 4.0)
[✓] VS Code, 64-bit edition (version 1.46.0)
[✓] Connected device (2 available)
! Doctor found issues in 1 category.
在BaseState里面的show对话框,我看到是直接push一个页面,什么都好,就是没处理好返回键的时候,只要show之后按下返回键,就再也show不出来了
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.