72 lines
No EOL
1.8 KiB
Dart
72 lines
No EOL
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:gitea_client/widget/login_form.dart';
|
|
import 'package:gitea_client/widget/login_status.dart';
|
|
|
|
import 'model/ApiAccess.dart';
|
|
|
|
void main() {
|
|
runApp(const MyApp());
|
|
}
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({Key? key}) : super(key: key);
|
|
|
|
// This widget is the root of your application.
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return MaterialApp(
|
|
title: 'Gitea Client',
|
|
theme: ThemeData(
|
|
primarySwatch: Colors.lightGreen,
|
|
),
|
|
home: const LoginPage(title: 'Gitea client'),
|
|
routes: {
|
|
|
|
},
|
|
onGenerateRoute: (route) {
|
|
switch (route.name) { // <- here
|
|
case "/loginstatus":
|
|
return MaterialPageRoute(
|
|
settings: const RouteSettings(name: "/parameterpage"),
|
|
builder: (context) => StatefulLoginStatus(
|
|
apiAccess: route.arguments as ApiAccess,
|
|
),
|
|
);
|
|
}
|
|
return null;
|
|
},
|
|
|
|
);
|
|
}
|
|
}
|
|
|
|
class LoginPage extends StatelessWidget {
|
|
const LoginPage({Key? key, required this.title}) : super(key: key);
|
|
|
|
final String title;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final media = MediaQuery.of(context).size;
|
|
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text(title),
|
|
),
|
|
body: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
Text("Login to Gitea",
|
|
style: Theme.of(context).textTheme.headline4),
|
|
SizedBox(
|
|
width:
|
|
(media.width > 600) ? media.width * 0.5 : media.width * 0.9,
|
|
child: const StatefulLoginForm(),
|
|
)
|
|
],
|
|
),
|
|
));
|
|
}
|
|
} |