stack_board
stack_board copied to clipboard
[Bug report]
Version
0.1.2
Platforms
dart, Android, iOS, macOS, Web, Windows, Linux
Device Model
google pixel pro 7
flutter info
[✓] Flutter (Channel stable, 3.13.1, on macOS 13.5.2 22G91 darwin-arm64, locale en-US)
• Flutter version 3.13.1 on channel stable at /Users/faiz/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision e1e47221e8 (3 weeks ago), 2023-08-22 21:43:18 -0700
• Engine revision b20183e040
• Dart version 3.1.0
• DevTools version 2.25.0
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/faiz/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
• CocoaPods version 1.12.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.82.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.72.0
[✓] Connected device (3 available)
• sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64 • Android 13 (API 33) (emulator)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.5.2 22G91 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 116.0.5845.179
[✓] Network resources
• All expected network resources are available.
• No issues found!
How to reproduce?
when we use it in high resolution it does not work.
Please check below GIF
Logs
No response
Example code (optional)
import 'package:ep_editor/app/modules/editor/demo/stickerview.dart';
import 'package:ep_editor/app/modules/editor/demo/transform_demo.dart';
import 'package:ep_editor/app/modules/editor/object_model.dart';
import 'package:ep_editor/generated/locales.g.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
import 'package:stack_board/stack_board.dart';
import 'package:wechat_assets_picker/wechat_assets_picker.dart';
import 'package:zoom_widget/zoom_widget.dart';
import '../controllers/editor_controller.dart';
import 'dart:math' as math;
class EditorView extends GetView<EditorController> {
const EditorView({Key? key}) : super(key: key);
Widget get _spacer => const SizedBox(width: 5);
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
// floatingActionButton: _floatingActionButton(),
appBar: AppBar(),
bottomNavigationBar: _floatingActionButton(),
// Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// Container(
// color: Colors.lightBlue.shade50,
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// children: [
// TextButton(
// onPressed: () {},
// child: Column(
// children: [
// SvgPicture.asset('assets/svg/text.svg'),
// const SizedBox(height: 5),
// Text(LocaleKeys.add_text.tr),
// ],
// ),
// ),
// ],
// ),
// )
// ],
// ),
body: Center(
child: AspectRatio(
aspectRatio: controller.hController.assetEntity!.size.width / controller.hController.assetEntity!.size.height,
child: Zoom(
initTotalZoomOut: true,
maxZoomWidth: controller.hController.assetEntity!.size.width,
maxZoomHeight: controller.hController.assetEntity!.size.height,
backgroundColor: Colors.white,
opacityScrollBars: 0,
scrollWeight: 0.0,
initScale: 0.0,
centerOnScale: true,
enableScroll: false,
doubleTapZoom: false,
zoomSensibility: 0.0,
child: Stack(
children: [
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetEntityImageProvider(controller.hController.assetEntity!),
fit: BoxFit.contain,
),
),
),
StackBoard(
controller: controller.boardController,
tapToCancelAllItem: true,
caseStyle: const CaseStyle(
borderColor: Colors.grey,
iconColor: Colors.white,
),
),
],
),
),
),
),
);
}
itemBuilder(ObjectModel object, int i) {
return TransformDemo(
object: controller.objectList[0],
child: Text(
'${controller.objectList[0].text}',
style: TextStyle(
fontSize: controller.hController.calculateBestFontSize('${controller.objectList[0].text}', 0.1),
),
),
);
}
_floatingActionButton() {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Flexible(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: <Widget>[
const SizedBox(width: 25),
OutlinedButton(
onPressed: () {
controller.boardController.add(
AdaptiveText('Flutter Candies',
id: 1,
tapToEdit: true,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 200,
),
caseStyle: CaseStyle(
borderColor: Colors.grey,
iconColor: Colors.white,
iconSize: 200,
borderWidth: 10,
)),
);
// controller.boardController.refresh();
// remove focus
// FocusScope.of(Get.context!).requestFocus(FocusNode());
},
child: const Icon(Icons.border_color),
),
_spacer,
OutlinedButton(
onPressed: () {
controller.boardController.add(
StackBoardItem(
tapToEdit: true,
child: Image.network('https://avatars.githubusercontent.com/u/47586449?s=200&v=4'),
),
);
},
child: const Icon(Icons.image),
),
_spacer,
OutlinedButton(
onPressed: () {
controller.boardController.add(
const StackDrawing(
caseStyle: CaseStyle(
borderColor: Colors.grey,
iconColor: Colors.white,
boxAspectRatio: 1,
),
),
);
},
child: const Icon(Icons.color_lens),
),
_spacer,
OutlinedButton(
onPressed: () {
controller.boardController.add(
StackBoardItem(
child: const Text('Custom Widget', style: TextStyle(color: Colors.black)),
onDel: _onDel,
// caseStyle: const CaseStyle(initOffset: Offset(100, 100)),
),
);
},
child: const Icon(Icons.add_box),
),
],
),
),
),
OutlinedButton(
onPressed: () => controller.boardController.clear(),
child: const Icon(Icons.close),
),
],
);
}
Future<bool> _onDel() async {
final bool? r = await showDialog<bool>(
context: Get.context!,
builder: (_) {
return Center(
child: SizedBox(
width: 400,
child: Material(
child: Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
const Padding(
padding: EdgeInsets.only(top: 10, bottom: 60),
child: Text('确认删除?'),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[
// IconButton(onPressed: () => Navigator.pop(context, true), icon: const Icon(Icons.check)),
// IconButton(onPressed: () => Navigator.pop(context, false), icon: const Icon(Icons.clear)),
],
),
],
),
),
),
),
);
},
);
return r ?? false;
}
}