bitmio 0.0.10 bitmio: ^0.0.10 copied to clipboard
Bitmio components.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:bitmio/bitmio.dart';
void main() => runApp(MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
final background = Image.asset(
'images/background.png',
fit: BoxFit.cover,
);
final logoImage = Image.asset('images/logo.png');
return MaterialApp(
theme: ThemeData(
brightness: Brightness.light,
primaryColor: Colors.lightBlue[800],
accentColor: Colors.cyan[600],
fontFamily: 'Montserrat',
textTheme: TextTheme(
display2: TextStyle(fontSize: 45),
button: TextStyle(fontSize: 14.0),
subhead: TextStyle(fontSize: 16.0) // input text
),
inputDecorationTheme: InputDecorationTheme(
labelStyle: TextStyle(fontSize: 16.0),
helperStyle: TextStyle(fontSize: 16.0),
hintStyle: TextStyle(fontSize: 16.0)),
buttonTheme: ButtonThemeData(
padding: EdgeInsets.only(left: 60, right: 60, top: 15, bottom: 15),
buttonColor: Colors.lightBlue[800], // <-- dark color
textTheme: ButtonTextTheme
.primary, // <-- this auto selects the right color
)),
darkTheme: ThemeData(
brightness: Brightness.dark,
primaryColor: Colors.orange,
accentColor: Colors.blueAccent,
buttonTheme: ButtonThemeData(
padding: EdgeInsets.only(left: 60, right: 60, top: 15, bottom: 15),
buttonColor: Colors.orange, // <-- dark color
textTheme: ButtonTextTheme
.primary, // <-- this auto selects the right color
)),
initialRoute: '/',
routes: {
'/': (context) => Bits(),
'/welcome': (context) => WelcomeWidget(
backgroundImage: background,
logo: logoImage,
),
'/login': (context) => HeaderDetailWidget(
detail: MyLogin(), background: background, logo: logoImage),
'/signup': (context) => HeaderDetailWidget(
detail: MySignup(), background: background, logo: logoImage),
'/webview-auth': (context) => WebviewAuth(
authUrl: 'https://bitmio.com/demo/login',
onCompletion: (result) => {print('Auth success $result')}),
'/onboarding': (context) {
final model = [
OnboardingPageModel(
backgroundImage: Image.asset('images/onboarding1.png'),
title: 'Be in control.',
description: 'Own your app and define the roadmap.'),
OnboardingPageModel(
backgroundImage: Image.asset('images/onboarding2.png'),
title: 'Control your budget.',
description: 'Own your app and define the roadmap. Own your app and define the roadmap. Own your app and define the roadmap.'),
OnboardingPageModel(
backgroundImage: Image.asset('images/onboarding3.png'),
title: 'Follow best-practices.',
description: 'Own your app and define the roadmap.')
];
return Onboarding(
model: model,
completionRoute: '/',
);
},
'/card': (context) {
final model = CardModel(
title: 'My Card with a pretty long title across multiple lines',
description: 'Create your own cards and theme them.',
date: 'Dec 20',
background: Image.asset('images/background.png'),
person: PersonModel(
name: 'Liza Li',
image: Image.asset('images/face2.jpeg').image));
final checklistModel = ChecklistModel(name: 'My Checklist', items: [
ChecklistItemModel(id: '1', name: 'Do this first'),
ChecklistItemModel(id: '2', name: 'Do this next'),
ChecklistItemModel(id: '3', name: 'Do this last')
]);
final checklist = ChecklistWidget(model: checklistModel);
return CardDetailWidget(
model: model,
widgets: <Widget>[checklist],
);
}
},
);
}
}
class Bits extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: ListView(
children: <Widget>[
Card(
child: ListTile(
title: Text('Welcome'),
onTap: () => {Navigator.pushNamed(context, '/welcome')},
)),
Card(
child: ListTile(
title: Text('Login'),
onTap: () => {Navigator.pushNamed(context, '/login')},
)),
Card(
child: ListTile(
title: Text('Signup'),
onTap: () => {Navigator.pushNamed(context, '/signup')},
)),
Card(
child: ListTile(
title: Text('Webview Auth'),
onTap: () => {Navigator.pushNamed(context, '/webview-auth')},
)),
Card(
child: ListTile(
title: Text('Onboarding'),
onTap: () => {Navigator.pushNamed(context, '/onboarding')},
)),
Card(
child: ListTile(
title: Text('Progress'),
onTap: () => {Navigator.pushNamed(context, '/progress')},
)),
Card(
child: ListTile(
title: Text('Card List'),
onTap: () => {Navigator.pushNamed(context, '/cards')},
)),
Card(
child: ListTile(
title: Text('Card'),
onTap: () => {Navigator.pushNamed(context, '/card')},
)),
Card(
child: ListTile(
title: Text('Documents'),
onTap: () => {Navigator.pushNamed(context, '/documents')},
)),
Card(
child: ListTile(
title: Text('Contacts'),
onTap: () => {Navigator.pushNamed(context, '/contacts')},
)),
],
),
);
}
}
class MyLogin extends StatefulWidget {
@override
_MyLoginState createState() {
return _MyLoginState();
}
}
class _MyLoginState extends State<MyLogin> {
@override
Widget build(BuildContext context) {
return LoginForm(
forgotLoginUrl: 'https://bitmio.com/demo/forgot-login',
onCompletion: (model, callback) {
print('Login ${model.email} - ${model.password}');
Future.delayed(const Duration(milliseconds: 1000), () {
callback();
});
});
}
}
class MySignup extends StatefulWidget {
@override
_MySignupState createState() {
return _MySignupState();
}
}
class _MySignupState extends State<MySignup> {
@override
Widget build(BuildContext context) {
return SignupForm(onCompletion: (model, callback) {
print('Signup ${model.email} - ${model.password}');
Future.delayed(const Duration(milliseconds: 1000), () {
callback();
});
});
}
}