|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- import 'dart:ui';
-
- import 'package:flutter/material.dart';
-
- //import 'package:flutter_svg/flutter_svg.dart';
- import 'package:touch_demonstrator/pages/PageTouchPoints.dart';
- import 'package:touch_demonstrator/src/blocs/BlocProvider.dart'; //bloc:
- import 'package:flutter/animation.dart';
-
- class Button extends StatelessWidget {
- /// Button that navigates to the page 'PageTouchPoints'
- @override
- Widget build(BuildContext context) {
- return Hero(
- tag: 'SearchHero',
- child: Padding(
- padding: const EdgeInsets.all(8.0),
- child: RaisedButton(
- color: Theme.of(context).accentColor,
- shape: StadiumBorder(),
- onPressed: () {
- Navigator.push(context,
- MaterialPageRoute(builder: (context) => PageTouchPoints()));
- },
- child: Text(
- 'Search and Connect Touchpad',
- style: TextStyle(color: Colors.white),
- ),
- ),
- ),
- );
- }
- }
-
- class TouchPad extends StatelessWidget {
- /// Image of the touch pad
- @override
- Widget build(BuildContext context) {
- return Padding(
- padding: const EdgeInsets.all(8.0),
- child: Image.asset('assets/trackpad.png'),
- );
- }
- }
-
- class ReusableWidgets {
- getAppBar(String title) {
- return AppBar(
- title: Text(title),
- );
- }
-
- getAppBar2(BuildContext context) {
- final bBloc = BlocProvider.of(context).bluetoothBlocGetter;
- String appBarText;
-
- return AppBar(
- title: StreamBuilder<bool>(
- stream: bBloc.isConnected$,
- initialData: false,
- builder: (BuildContext context, AsyncSnapshot<bool> snapshot) {
- if (snapshot.hasData) {
- if (snapshot.data) {
- appBarText = 'Connected';
- } else {
- // _showSnackbar('Disconnected');
- // return Text('Disconnected');
- appBarText = 'Disconnected';
- }
- return AnimatedSwitcher(
- duration: const Duration(milliseconds: 350),
- transitionBuilder: (Widget child, Animation<double> opacity) {
- return FadeTransition(child: child, opacity: opacity);
- },
- child: new Text(
- '$appBarText',
- // Must have this key to build a unique widget when _count changes.
- key: new ValueKey<String>(appBarText),
- textScaleFactor: 1.0,
-
- textDirection: TextDirection.ltr,
- ),
- );
- } else
- return Text('Disconnected');
- }),
- // actions: <Widget>[
- // enableDebug ?IconButton(
- // icon: Icon(Icons.build),
- // onPressed: () {
- // print('pressed');
- // Navigator.push(
- // context, MaterialPageRoute(builder: (context) => DebugView()));
- // },
- // ):Container(),
- // ],
- );
- }
- }
-
-
|