实现的功能:1.写文字。2.插入视频和图片。3.视频的播放4.图片的点击放大预览。界面展示:
核心概念:组件,构建,状态,框架等。Flutter的特点: 跨平台:现在flutter至少可以跨5种平台,常见的平台:MacOS,Windows ,Linux ,Android ,iOS ,到目前为止,Flutter算是支持平台最多的框架了。良好的跨平台性,大大减少了开发成本。 丝滑般的体验:使用Flutter内置的Material Design(android风格)和Cupertino(ios风
import 'package:flutter/material.dart';class ImageDemo extends StatelessWidget { @override Widget build(BuildContext context) { return new Center( //添加网络图片 child: new Image.network(
需要在调试模式下运行,才能热加载。
// 基础列表class CustomList extends StatelessWidget { @override Widget build(BuildContext context) { final title = "基础列表示例"; return MaterialApp( title: title, home: Scaffold( appB
1.引入库。video_player: ^0.10.0+2import 'package:flutter/cupertino.dart';import 'package:flutter/material.dart';import 'package:video_player/video_player.dart';void main() => runApp(showVideo());class
WindowsPUB_HOSTED_URL ===== https://pub.flutter-io.cnFLUTTER_STORAGE_BASE_URL ===== https://storage.flutter-io.cn 增加两个环境变量,然后执行一下 flutter doctor命令。问题完美解决。
//水平表class MyHorList extends StatelessWidget { @override Widget build(BuildContext context) { final title = "水平列表示例"; return MaterialApp( title: title, home: Scaffold( appBar:
import 'package:flutter/material.dart';//列表左右滑动删除void main() => runApp(MaterialApp( home: HomePage(), ));class HomePage extends StatelessWidget { final List<String> items = List.g
Scaffold :脚手架一般来说,总是定义一个 Scaffold 当作实参传入到 MaterialApp 的 home 属性。换句话说,一个 MaterialApp 总是绑定一个 Scaffold。Scaffold定义了一个 UI 框架,这个框架包含: 头部导航栏,body,右下角浮动按钮,底部导航栏等。...
1.先引入库image_picker2.功能代码 import 'package:flutter/cupertino.dart';import 'package:flutter/material.dart';import 'package:image_picker/image_picker.dart';void main() => runApp(selectImag());class se
import 'package:flutter/cupertino.dart';import 'package:flutter/material.dart';import 'package:video_player/video_player.dart';void main() { runApp(new MaterialApp( title: 'Container demo', hom
audio_recorder: any #录音、播放 flutter_sound: ^1.1.5#录音 dropdown_menu: ^1.1.0#下拉菜单 simple_permissions:#权限获取 easy_alert:#弹框 amap_location: any #高德地图 location: any #gogle位置获取 barcode_scan 0
import 'package:flutter/material.dart';//单选和多选void main() => runApp(MaterialApp( home: _home(), ));class _home extends StatefulWidget { @override State<StatefulWidget> createState()
引入插件:charts_flutter: ^0.4.0ChartFlutterBeanimport 'package:charts_flutter/flutter.dart';import 'package:myself_project/OrdinalSales%20.dart';class ChartFlutterBean { static List<Series<TimeSeri
仅供参考:引入插件:file_picker: ^1.3.8按照返回值,分了三组:// Single file path String filePath;第一组:返回文件地址 //选择任何文件 filePath = await FilePicker.getFilePath(type: FileType.ANY); // will let you pick one file path, from al
推荐一个json转实体类的在线网站,功能同于android原生的jsonFormate插件import 'package:flutter/material.dart';import 'dart:convert';void main() { runApp(new MyJson());}class Person { String name; String age; Person child;
// 服务页itemWidget _buildGridService() { return Scaffold( appBar: AppBar( elevation: 8.0, //阴影的高度 title: Text('便民服务'), backgroundColor: MyColors.color_red, centerTitle
引入库:dio: ^2.1.13 可直接运行的代码:包含了post,get 下载文件 import 'package:flutter/material.dart';import 'package:dio/dio.dart';void main() { runApp(new MaterialApp( title: 'Container demo', home: new visitN
android studio中修改了diart sdk路径,需要执行以下步骤:
[ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: type 'DioError' is not a subtype of type 'String'下载文件出现上述错误:Response response = await dio.download( "https://123.sogou.com/", "/sto
颜色资源的定义:import 'package:flutter/material.dart';class MyColors { ///主色调 #6BA2FA static const Color color_main = Color.fromARGB(255, 107, 162, 250); ///按钮暗色调 static const Color red_aa = Color(0xffaa
SafeArea:能很好的解决刘海,不规则屏幕的显示问题。
import 'package:flutter/material.dart';void main() { runApp(new MaterialApp( title: 'Container demo', home: new MyScrv(), ));}class MyScrv extends StatefulWidget { @override State<Statefu
当条目过少时listview某些嵌套情况下可能不会滚动(条目多时,超出一个屏幕,不会出现此问题),RefreshIndicator是根据下拉偏移量触发onRefresh操作,不能滚动自然不能下拉刷新。在listview的physice属性赋值new AlwaysScrollableScrollPhysics(),如上图,保持listview任何情况都能滚动,问题解决。...
new Text('Text style', textAlign: TextAlign.center, style: new TextStyle( fontSize: 12.0, fontWeight: FontWeight.bold, color: Colors.black,), overflow: TextOverflow.ellips
child: Container( decoration: new BoxDecoration( color: Colors.grey, ),
Divider( height: 1.0, indent: 0.0, color: MyColors.color_gray_150,),
Copyright © 2005-2024 51CTO.COM 版权所有 京ICP证060544号