我正在使用此功能来确保正确打开和关闭盒子,但我仍然收到HiveError: Box has already been closed.错误
static Future<Box<dynamic>> openIt() async {
var connectionBox = await Hive.openBox(hiveBox);
if (Hive.isBoxOpen(hiveBox) == false) {
await Hive.openBox(hiveBox);
} else {
await connectionBox.close();
connectionBox = await Hive.openBox(hiveBox);
}
return connectionBox;
}
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题。
我正在使用 google_maps_flutter 包在应用程序中创建地图。我正在使用下面的功能
GoogleMap(
initialCameraPosition: CameraPosition(
target: _locationCoords, zoom: 12.0),
markers: Set.from(allMarkers),
onMapCreated: mapCreated,
zoomControlsEnabled: true,
zoomGesturesEnabled: true,
scrollGesturesEnabled: true,
compassEnabled: true,
)
Run Code Online (Sandbox Code Playgroud)
问题出在缩放控件上。我可以看到出现缩放控件,但我想更改缩放控件的位置以显示在右侧。是否可以更改缩放控件的位置。
我正在使用这个命令来创建构建
flutter build apk --split-per-abi --no-sound-null-safety --no-tree-shake-icons --no-shrink -v
Run Code Online (Sandbox Code Playgroud)
我使用的是颤振版本2.5.0
我收到这个错误
Caused by: java.lang.ClassNotFoundException: com.android.tools.lint.client.api.Vendor
[ ] at com.intellij.util.lang.UrlClassLoader.findClass(UrlClassLoader.java:328)
[ ] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
[ ] at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题来创建构建?
我想在IOS上创建类似whatsapp的效果。即,当我开始向下滚动文本折叠栏时,在用户[联系人]屏幕上,将出现文本字段。当我向上滚动时,文本将位于应用栏中间,搜索文本字段将消失。我正在使用 CustomScrollview 和 slivers 来实现这种效果。title of FlexibleSpaceBar当我在使用列小部件添加文本字段时遇到一个问题。文本“折叠栏”正在向上移动到应用栏上方,我不知道添加它的另一种方法,我正在尝试下面的代码
import 'package:flutter/material.dart';
class Test extends StatefulWidget {
@override
_TestState createState() => _TestState();
}
class _TestState extends State<Test> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
floating: false,
pinned: true,
expandedHeight: 200,
leading: Container(
margin: EdgeInsets.only(
left: 15,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
InkWell(
onTap: () {
},
child: Text(
'Edit',
style: TextStyle(
fontSize: 16,
),
),
),
],
),
),
actions: <Widget>[
Container(
margin: …Run Code Online (Sandbox Code Playgroud) 我正在使用带有三个子小部件的行小部件:文本图标文本
我希望所有这些都水平出现在同一级别的单行中,如果文本增加,则下降到新行。
我正在为 Row 小部件使用以下代码,但最后一个 Text 小部件未正确对齐

文本放置应从“ Tap”下方开始,并且“ on the right hand”不对齐
Row(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(
'Tap ',
style: TextStyle(
fontSize: 17,
),
),
Icon(Icons.add),
Expanded(
child: Text(
'on the right hand corner to start a new chat.',
style: TextStyle(
fontSize: 17,
),
),
)
],
)
Run Code Online (Sandbox Code Playgroud) 我正在使用 Imagick 库在图像上添加文本。我已经在图像上定义了区域,from x:280 to x:400
我正在该区域中写入文本,并且我想将该文本对齐在居中文本 x:1 和 x:400 中的以下代码的中心
$draw = new ImagickDraw();
$draw->setFillColor('white');
$draw->setFont($tffFile);
$draw->setTextAlignment(Imagick::ALIGN_CENTER);
$draw->setFontSize( 14 );
$image->annotateImage($draw, 280, 80, 0, 'Hey there');
Run Code Online (Sandbox Code Playgroud) 我想在 gridview 中有一个固定高度的容器。我正在使用以下代码。它在不同设备上显示不同的高度。有什么方法可以控制高度,使其在所有设备上看起来都相同。
GridView.count(
shrinkWrap: true,
crossAxisCount: 2,
mainAxisSpacing: 0,
childAspectRatio:
MediaQuery.of(context).size.width /
(MediaQuery.of(context).size.height / 1),
crossAxisSpacing: 8,
children: _productData.map((opt) {
return _productCard(context, opt, cart);
}).toList(),
),
Run Code Online (Sandbox Code Playgroud) 我无法在 laravel 项目中添加新包。我正在使用 laravel 7.2 我试图运行这个命令
composer require stripe/stripe-php
Run Code Online (Sandbox Code Playgroud)
但我得到了以下错误。
Problem 1
- Root composer.json requires kreait/laravel-firebase ^3.0,
found kreait/laravel-firebase[3.0.0]
but the package is fixed to 2.2.0 (lock file version)
by a partial update and that version does not match.
Make sure you list it as an argument for the update command.
Use the option --with-all-dependencies (-W) to allow upgrades,
downgrades and removals for packages currently locked to specific versions.
Run Code Online (Sandbox Code Playgroud)
我也尝试过作曲家更新,但仍然收到此错误。
最近sharethis插件已更新.我已成功安装,它工作正常.但我无法加载ajax调用上的按钮.我添加了这个脚本
<script type="text/javascript" src="//platform-api.sharethis.com/js/sharethis.js#property=propertystring&product=inline-share-buttons"></script>
Run Code Online (Sandbox Code Playgroud)
旧代码使用以下内容
stButtons.locateElements();
Run Code Online (Sandbox Code Playgroud)
不再工作了.
请注意我使用自定义共享按钮.
我正在使用 google_maps_flutter。我的小部件树是 Scaffold -> SingleChildScrollView -> Stack 然后是谷歌地图。我无法使用手势放大和缩小。
SingleChildScrollView( Stack(
children: <Widget>[
Container(
height: MediaQuery.of(context).size.height - 10.0,
width: MediaQuery.of(context).size.width * 1,
child: _mapView
? GoogleMap(
initialCameraPosition: CameraPosition(
target: _outletData[0].locationCoords, zoom: 12.0),
markers: Set.from(allMarkers),
onMapCreated: mapCreated,
zoomControlsEnabled: false,
zoomGesturesEnabled: true,
scrollGesturesEnabled: true,
compassEnabled: true,
rotateGesturesEnabled: true,
mapToolbarEnabled: true,
tiltGesturesEnabled: true,
)
: Container(),
),
Run Code Online (Sandbox Code Playgroud)
我也尝试过下面的代码,但仍然无法使用两指触摸放大缩小
Stack(
children: <Widget>[
Container(
height: MediaQuery.of(context).size.height - 10.0,
width: MediaQuery.of(context).size.width * 1,
child: _mapView
? GoogleMap(
initialCameraPosition: CameraPosition(
target: _outletData[0].locationCoords, zoom: 12.0),
markers: Set.from(allMarkers),
onMapCreated: mapCreated, …Run Code Online (Sandbox Code Playgroud) flutter ×7
google-maps ×2
php ×2
composer-php ×1
flutter-hive ×1
gridview ×1
imagick ×1
laravel ×1
sharethis ×1