initial pages

This commit is contained in:
2023-11-26 07:54:08 -03:00
parent e562891b3c
commit e2c2fa48ce
10 changed files with 265 additions and 114 deletions
+41
View File
@@ -0,0 +1,41 @@
import 'package:flutter/material.dart';
import 'package:pcast/components/nc_base_page.dart';
import 'package:routefly/routefly.dart';
import '../components/nc_button.dart';
class AppPage extends StatelessWidget {
const AppPage({super.key});
@override
Widget build(BuildContext context) {
return NcBasePage(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
NcButton(
caption: "Quero testar a plataforma",
backgroundColor: Colors.black,
captionColor: Colors.white,
onPressed: () => {
Routefly.navigate('/test'),
},
),
const SizedBox(
height: 40,
),
NcButton(
caption: "Já sou cliente",
backgroundColor: Colors.black,
captionColor: Colors.white,
onPressed: () => {
Routefly.navigate('/login'),
},
),
],
),
),
);
}
}
+17
View File
@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:routefly/routefly.dart';
import '../routes.dart';
class AppWidget extends StatelessWidget {
const AppWidget({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp.router(
routerConfig: Routefly.routerConfig(
routes: routes,
),
);
}
}
+31
View File
@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:pcast/components/nc_base_page.dart';
class LoginPage extends StatefulWidget {
const LoginPage({super.key});
@override
State<LoginPage> createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
@override
Widget build(BuildContext context) {
return const NcBasePage(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Login Page",
style: TextStyle(
color: Colors.white,
fontSize: 40,
),
),
],
),
),
);
}
}
+31
View File
@@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
import 'package:pcast/components/nc_base_page.dart';
class TestPage extends StatefulWidget {
const TestPage({super.key});
@override
State<TestPage> createState() => _TestPageState();
}
class _TestPageState extends State<TestPage> {
@override
Widget build(BuildContext context) {
return const NcBasePage(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Test Page",
style: TextStyle(
color: Colors.white,
fontSize: 40,
),
),
],
),
),
);
}
}
+15
View File
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';
class NcBasePage extends StatelessWidget {
const NcBasePage({super.key, required this.body});
final Widget body;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xffa600f9),
body: body,
);
}
}
+30
View File
@@ -0,0 +1,30 @@
import 'package:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart';
class NcButton extends StatelessWidget {
const NcButton({super.key, required this.caption, required this.backgroundColor, required this.captionColor, this.onPressed});
final String caption;
final Color backgroundColor;
final Color captionColor;
final void Function()? onPressed;
@override
Widget build(BuildContext context) {
return SizedBox(
width: 500,
height: 100,
child: ElevatedButton(
onPressed: onPressed,
style: ElevatedButton.styleFrom(
backgroundColor: backgroundColor,
foregroundColor: captionColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: caption.text.xl4.make(),
),
);
}
}
+3 -65
View File
@@ -1,69 +1,7 @@
import 'package:flutter/material.dart';
import 'app/app_widget.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
runApp(const AppWidget());
}
+41
View File
@@ -0,0 +1,41 @@
import 'package:routefly/routefly.dart';
import 'app/app_page.dart' as a0;
import 'app/login/login_page.dart' as a1;
import 'app/test/test_page.dart' as a2;
List<RouteEntity> get routes => [
RouteEntity(
key: '/',
uri: Uri.parse('/'),
routeBuilder: (ctx, settings) => Routefly.defaultRouteBuilder(
ctx,
settings,
const a0.AppPage(),
),
),
RouteEntity(
key: '/login',
uri: Uri.parse('/login'),
routeBuilder: (ctx, settings) => Routefly.defaultRouteBuilder(
ctx,
settings,
const a1.LoginPage(),
),
),
RouteEntity(
key: '/test',
uri: Uri.parse('/test'),
routeBuilder: (ctx, settings) => Routefly.defaultRouteBuilder(
ctx,
settings,
const a2.TestPage(),
),
),
];
const routePaths = (
path: '/',
login: '/login',
test: '/test',
);