white_board_flutter 0.0.13 copy "white_board_flutter: ^0.0.13" to clipboard
white_board_flutter: ^0.0.13 copied to clipboard

discontinued

白板的flutter插件

example/lib/main.dart

import 'dart:io';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:white_board_flutter/white_board_flutter.dart';

void main() => runApp(new MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      title: 'Flutter Demo',
      theme: new ThemeData(
        // This is the theme of your application.
        //
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or press Run > Flutter Hot Reload in IntelliJ). Notice that the
        // counter didn't reset back to zero; the application is not restarted.
        primarySwatch: Colors.blue,
      ),
      home: new MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePage createState() => new _MyHomePage();
}

class _MyHomePage extends State<MyHomePage> {
  final scaffoldKey = GlobalKey();
  final mainWhiteBoardKey = GlobalKey<WhiteBoardState>();

  @override
  void initState() {
    super.initState();
   // WhiteBoardFlutter.setServerConfig(name, protocol, host, port);
    _join();
  }

  @override
  void dispose(){
    super.dispose();
    _leave();
  }


  _join() async {
    await WhiteBoardFlutter.login(
        "2943137f-46c9-4684-b4aa-1ec32e57247c",
        "ece820a2-483a-4e5b-b4e5-3bd06070c0b7");
    await WhiteBoardFlutter.joinRoom("5335fe4eda984ac4aa6adf0737a49c77");
  }
  
  _leave() async {
    await WhiteBoardFlutter.logout();
    await WhiteBoardFlutter.leaveRoom('5335fe4eda984ac4aa6adf0737a49c77');
  }

  _showMagnifier() {
    final whiteBoardKey = GlobalKey();

    showModalBottomSheet(
        context: context,
        builder: (context) => Container(
              height: 200.0,
              child: WhiteBoardWidget(
                key: whiteBoardKey,
                boardType: BoardType.assist,
                whiteBoardCreated: (width, height) =>
                    WhiteBoardFlutter.openMagnifier(0.0),
              ),
            ));
  }

  _screenshot() async {
    final path = await WhiteBoardFlutter.screenshots();

    if (path != null) {
      showDialog(
          context: context,
          builder: (context) => Container(
                color: Colors.cyan,
                child: Image.file(File(path)),
              ));
    }
  }

  @override
  Widget build(BuildContext context) {

    List<String> list = ['login','logout','joinRoom','leaveRoom','create',
    'update','changeBoardType','close','touch','setMagnifyScale',
    'getMagnifyScale','insertFile','insertCloudFile','updatePenStyle',
    'updateInputMode','boardCommand','openMagnifier','closeMagnifier',
    'zoomMoveNext','zoomMoveLast','zoomMoveNewLine','sendChatMessage',
    'getChatMessages','sendPing','joinChatRoom','leaveChatRoom',
    'leaveFullScreen','insertText','deleteText','screenshots'];

    _tapButton(int index){
      switch (list[index]){
        case 'login':
          {
            break;
          }
      }

    }

    return new Scaffold(
      key: scaffoldKey,
      appBar: new AppBar(
        title: const Text('Plugin example app'),
      ),
      body: Column(
        children: <Widget>[
          SizedBox(
            height: 60.0,
            child: ListView.builder(
              scrollDirection: Axis.horizontal,
              itemCount: list.length,
              itemBuilder: (context, index) {
                return FlatButton(
                  child: Text(list[index]),
                  onPressed: _tapButton(index),
                );
              },
            ),
          ),
          Expanded(
            child: AspectRatio(
              aspectRatio: 1.6,
              child: WhiteBoardWidget(
                key: mainWhiteBoardKey,
              ),
            ),
          )
        ],
      ),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
      floatingActionButton: FloatingActionButton(
        onPressed: () => _screenshot(),
        tooltip: 'Increment',
        child: new Icon(Icons.add),
      ),
    );
  }
}
0
likes
15
pub points
0%
popularity

Publisher

unverified uploader

白板的flutter插件

Homepage

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on white_board_flutter