You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.4 KiB
81 lines
2.4 KiB
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
|
class TestPage extends StatefulWidget { |
|
@override |
|
State<StatefulWidget> createState() { |
|
return _TestPage(); |
|
} |
|
} |
|
|
|
class _TestPage extends State<TestPage> { |
|
// ZefyrController controller = ZefyrController(NotusDocument.fromDelta(null)); |
|
// FocusNode focusNode = FocusNode(); |
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
// 改变样式 |
|
// final theme = ZefyrThemeData( |
|
// toolbarTheme: ToolbarTheme.fallback(context), |
|
// ); |
|
|
|
return Scaffold( |
|
// resizeToAvoidBottomInset: true, |
|
// appBar: AppBar( |
|
// elevation: 1.0, |
|
// backgroundColor: Colors.grey.shade200, |
|
// brightness: Brightness.light, |
|
// title: Text("data"), |
|
// ), |
|
// body: ZefyrScaffold( |
|
// child: ZefyrTheme( |
|
// data: theme, |
|
// child: ZefyrEditor( |
|
// controller: controller, |
|
// focusNode: focusNode, |
|
// imageDelegate: CustomImageDelegate(), |
|
// ), |
|
// ), |
|
// ), |
|
); |
|
} |
|
} |
|
|
|
// class CustomImageDelegate implements ZefyrImageDelegate<String> { |
|
// String url = ""; |
|
// |
|
// @override |
|
// Future<String> pickImage(String source) async { |
|
// // final file = await ImagePicker.pickImage(source: source); |
|
// // if (file == null) return null; |
|
// // // Use my storage service to upload selected file. The uploadImage method |
|
// // // returns unique ID of newly uploaded image on my server. |
|
// // |
|
// // // 这里是我的后端地址(你们可以写自己的后台地址 |
|
// // var request = await requestfile("url",file, null); |
|
// // print(request); |
|
// // if(request["code"] == "200") { |
|
// // print("图片上传成功"); |
|
// // } else { |
|
// // print("图片上传失败"); |
|
// // } |
|
// // url = "$SERVER_URL/static/articlePictre/${request["data"]}"; |
|
// return url; |
|
// } |
|
// |
|
// @override |
|
// Widget buildImage(BuildContext context, String imageSource) { |
|
// // We use custom "asset" scheme to distinguish asset images from other files. |
|
// print("imageSource is $imageSource"); |
|
// // 这里拿到刚才return url 也就是 delta 的文本内容,不可以使用上面的url,直接 imageSource 就可以 |
|
// return Image.network(imageSource); |
|
// } |
|
// |
|
// @override |
|
// String get cameraSource => url; |
|
// |
|
// @override |
|
// String get gallerySource => url; |
|
// |
|
// }
|
|
|