Initial Commit
This commit is contained in:
105
web_native/lib/screens/home_screen.dart
Normal file
105
web_native/lib/screens/home_screen.dart
Normal file
@@ -0,0 +1,105 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||
import 'package:flutter_staggered_grid_view/flutter_staggered_grid_view.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
static const String PATH = '/Home';
|
||||
|
||||
HomeScreen({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_HomeScreenState createState() => _HomeScreenState();
|
||||
}
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen> {
|
||||
|
||||
// HomeBloc bloc;
|
||||
|
||||
void _init(){
|
||||
// if(null == bloc){
|
||||
// bloc = HomeBloc(AppProvider.getApplication(context));
|
||||
// }
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
// bloc.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_init();
|
||||
|
||||
return PlatformScaffold(
|
||||
body: _buildGridView(),
|
||||
bottomNavBar: _buildNavBar()
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildNavBar() {
|
||||
return PlatformNavBar(
|
||||
currentIndex: 0,
|
||||
itemChanged: (index) => setState(
|
||||
() {
|
||||
// _selectedTabIndex = index;
|
||||
print(index);
|
||||
},
|
||||
),
|
||||
items: [
|
||||
BottomNavigationBarItem(
|
||||
label: "Gallery",
|
||||
icon: Icon(PlatformIcons(context).collections),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
label: "Me",
|
||||
icon: Icon(PlatformIcons(context).person),
|
||||
),
|
||||
BottomNavigationBarItem(
|
||||
label: "Settings",
|
||||
icon: Icon(PlatformIcons(context).settings),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildGridView() {
|
||||
// return GridView.builder(
|
||||
// itemCount: 5,
|
||||
// gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
|
||||
// childAspectRatio: (1 / 1),
|
||||
// crossAxisCount: 2),
|
||||
// itemBuilder: (BuildContext context, int index) {
|
||||
// return _buildCard("https://i.imgur.com/CgSGqUz.jpeg");
|
||||
// }
|
||||
// );
|
||||
|
||||
|
||||
return new StaggeredGridView.countBuilder(
|
||||
crossAxisCount: 4,
|
||||
itemCount: 80,
|
||||
itemBuilder: (BuildContext context, int index) => _buildCard("https://i.imgur.com/CgSGqUz.jpeg"),
|
||||
// itemBuilder: (BuildContext context, int index) => new Container(
|
||||
// color: Colors.green,
|
||||
// child: new Center(
|
||||
// child: new CircleAvatar(
|
||||
// backgroundColor: Colors.white,
|
||||
// child: new Text('$index'),
|
||||
// ),
|
||||
// )),
|
||||
staggeredTileBuilder: (int index) =>
|
||||
// new StaggeredTile.count(2, index.isEven ? 2 : 1),
|
||||
new StaggeredTile.fit(2),
|
||||
mainAxisSpacing: 4.0,
|
||||
crossAxisSpacing: 4.0,
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildCard(charImageUrl) {
|
||||
return new Image.network(
|
||||
charImageUrl,
|
||||
fit: BoxFit.contain,
|
||||
);
|
||||
}
|
||||
}
|
||||
94
web_native/lib/screens/login_screen.dart
Normal file
94
web_native/lib/screens/login_screen.dart
Normal file
@@ -0,0 +1,94 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fluro/fluro.dart';
|
||||
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||
|
||||
import 'package:imagini/core/app_provider.dart';
|
||||
|
||||
class LoginScreen extends StatefulWidget {
|
||||
static const String PATH = '/Login';
|
||||
|
||||
LoginScreen({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_LoginScreenState createState() => _LoginScreenState();
|
||||
}
|
||||
|
||||
class _LoginScreenState extends State<LoginScreen> {
|
||||
|
||||
// LoginBloc bloc;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
// bloc.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_init();
|
||||
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 500),
|
||||
child: Container(
|
||||
margin: EdgeInsets.fromLTRB(50, 0, 50, 0),
|
||||
height: 500,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.contain,
|
||||
child: const FlutterLogo(),
|
||||
),
|
||||
width: 175,
|
||||
margin: EdgeInsets.fromLTRB(0, 0, 0, 50),
|
||||
),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Server Address'
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Username / Email'
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TextField(
|
||||
obscureText: true,
|
||||
enableSuggestions: false,
|
||||
autocorrect: false,
|
||||
decoration: InputDecoration(
|
||||
labelText: 'Password'
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: PlatformButton(
|
||||
onPressed: () {
|
||||
AppProvider.getRouter(context).navigateTo(context, "/Home", transition: TransitionType.fadeIn);
|
||||
},
|
||||
child: Text('Login')
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _init(){
|
||||
// if(null == bloc){
|
||||
// bloc = LoginBloc(AppProvider.getApplication(context));
|
||||
// }
|
||||
}
|
||||
}
|
||||
70
web_native/lib/screens/splash_screen.dart
Normal file
70
web_native/lib/screens/splash_screen.dart
Normal file
@@ -0,0 +1,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
|
||||
import 'package:fluro/fluro.dart';
|
||||
|
||||
import 'package:imagini/core/app_provider.dart';
|
||||
import 'package:imagini/blocs/splash_bloc.dart';
|
||||
import 'package:imagini/graphql/imagini_graphql.dart';
|
||||
|
||||
class SplashScreen extends StatefulWidget {
|
||||
static const String PATH = '/';
|
||||
|
||||
SplashScreen({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_SplashScreenState createState() => _SplashScreenState();
|
||||
}
|
||||
|
||||
class _SplashScreenState extends State<SplashScreen> {
|
||||
|
||||
SplashBloc bloc;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
bloc.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_init();
|
||||
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(maxWidth: 500),
|
||||
child: Container(
|
||||
margin: EdgeInsets.fromLTRB(50, 0, 50, 0),
|
||||
height: 270,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: FittedBox(
|
||||
fit: BoxFit.contain,
|
||||
child: const FlutterLogo(),
|
||||
),
|
||||
width: 175,
|
||||
margin: EdgeInsets.fromLTRB(0, 0, 0, 50),
|
||||
),
|
||||
PlatformCircularProgressIndicator()
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _init(){
|
||||
if(null == bloc){
|
||||
bloc = SplashBloc(AppProvider.getApplication(context));
|
||||
bloc.loginResult.listen((Login$Query$AuthResponse lr) {
|
||||
if (lr.result == AuthResult.success) {
|
||||
AppProvider.getRouter(context).navigateTo(context, "/Home", transition: TransitionType.fadeIn);
|
||||
} else {
|
||||
AppProvider.getRouter(context).navigateTo(context, "/Login", transition: TransitionType.fadeIn);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
38
web_native/lib/screens/template_screen.dart.template
Normal file
38
web_native/lib/screens/template_screen.dart.template
Normal file
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class TemplatesScreen extends StatefulWidget {
|
||||
static const String PATH = '/Templates';
|
||||
|
||||
TemplatesScreen({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_TemplatesScreenState createState() => _TemplatesScreenState();
|
||||
}
|
||||
|
||||
class _TemplatesScreenState extends State<TemplatesScreen> {
|
||||
|
||||
// TemplatesBloc bloc;
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
// bloc.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
_init();
|
||||
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Text("Templates")
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _init(){
|
||||
// if(null == bloc){
|
||||
// bloc = TemplatesBloc(AppProvider.getApplication(context));
|
||||
// }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user