mirror of
https://github.com/amigan/calls.git
synced 2024-11-21 04:19:47 -05:00
wip
This commit is contained in:
parent
d61ce79c29
commit
9d58f4fa7f
4 changed files with 77 additions and 7 deletions
|
@ -1,15 +1,12 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'views/radio.dart';
|
||||
import 'controller/ws.dart';
|
||||
|
||||
void main() {
|
||||
LiveFeeder f = LiveFeeder();
|
||||
f.init();
|
||||
runApp(const MyApp());
|
||||
runApp(const CallsApp());
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
const MyApp({super.key});
|
||||
class CallsApp extends StatelessWidget {
|
||||
const CallsApp({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
71
lib/views/login.dart
Normal file
71
lib/views/login.dart
Normal file
|
@ -0,0 +1,71 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class Login extends StatefulWidget {
|
||||
const Login({super.key, required this.title});
|
||||
|
||||
final String title;
|
||||
|
||||
@override
|
||||
State<Login> createState() => _LoginState();
|
||||
}
|
||||
|
||||
class _LoginState extends State<Login> {
|
||||
final _formKey = GlobalKey<FormState>();
|
||||
TextEditingController userController = TextEditingController();
|
||||
TextEditingController passwordController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Form(
|
||||
key: _formKey,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
||||
child: Column(children: [
|
||||
TextFormField(
|
||||
controller: userController,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(), labelText: "Username"),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Please enter your username.';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
||||
child: TextFormField(
|
||||
controller: passwordController,
|
||||
obscureText: true,
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(), labelText: "Password"),
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return 'Please enter your password';
|
||||
}
|
||||
return null;
|
||||
},
|
||||
)),
|
||||
Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 8, vertical: 16.0),
|
||||
child: Center(
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
if (_formKey.currentState!.validate()) {
|
||||
// TODO do login here
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('Please login.')),
|
||||
);
|
||||
}
|
||||
},
|
||||
child: const Text('Login'),
|
||||
),
|
||||
)),
|
||||
])),
|
||||
));
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import '../../views/lcd.dart';
|
||||
import '../../views/keypad.dart';
|
||||
import '../controller/ws.dart';
|
||||
|
||||
class MainRadio extends StatefulWidget {
|
||||
const MainRadio({super.key, required this.title});
|
||||
|
@ -12,6 +13,7 @@ class MainRadio extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _MainRadioState extends State<MainRadio> {
|
||||
LiveFeeder f = LiveFeeder();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return const Scaffold(
|
||||
|
|
|
@ -13,7 +13,7 @@ import 'package:calls/main.dart';
|
|||
void main() {
|
||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
||||
// Build our app and trigger a frame.
|
||||
await tester.pumpWidget(const MyApp());
|
||||
await tester.pumpWidget(const CallsApp());
|
||||
|
||||
// Verify that our counter starts at 0.
|
||||
expect(find.text('0'), findsOneWidget);
|
||||
|
|
Loading…
Reference in a new issue