Maxio
This commit is contained in:
@@ -22,10 +22,19 @@ class _FeedPageState extends State<FeedPage> {
|
||||
return Card(
|
||||
child: ListTile(
|
||||
title: Text(feedItem.text),
|
||||
subtitle: Text(getTimeString(feedItem.timestamp)),
|
||||
trailing: Text(
|
||||
'${feedItem.timestamp.hour}:${feedItem.timestamp.minute}',
|
||||
style: Theme.of(context).textTheme.bodyLarge!.copyWith(),
|
||||
trailing: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(getTimeString(feedItem.timestamp)),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 15),
|
||||
),
|
||||
Text(
|
||||
'${feedItem.timestamp.hour}:${feedItem.timestamp.minute}',
|
||||
style: Theme.of(context).textTheme.bodyLarge!.copyWith(),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -46,9 +55,11 @@ String getTimeString(DateTime time) {
|
||||
} else if (duration.inDays > 1) {
|
||||
return '${duration.inDays} days ago';
|
||||
} else if (duration.inHours > 0) {
|
||||
return '${duration.inHours} hours ago';
|
||||
String text = duration.inHours == 1 ? 'hour' : 'hours';
|
||||
return '${duration.inHours} $text ago';
|
||||
} else if (duration.inMinutes > 0) {
|
||||
return '${duration.inMinutes} minutes ago';
|
||||
String text = duration.inMinutes == 1 ? 'minute' : 'minutes';
|
||||
return '${duration.inMinutes} $text ago';
|
||||
} else {
|
||||
return 'just seconds ago';
|
||||
}
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:audioplayers/audioplayers.dart';
|
||||
import '../services/db_helper.dart';
|
||||
|
||||
class LoginPage extends StatelessWidget {
|
||||
class LoginPage extends StatefulWidget {
|
||||
const LoginPage({super.key});
|
||||
|
||||
@override
|
||||
State<LoginPage> createState() => _LoginPageState();
|
||||
}
|
||||
|
||||
class _LoginPageState extends State<LoginPage> {
|
||||
double _height = 0;
|
||||
final player = AudioPlayer();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double width = MediaQuery.of(context).size.width / 2;
|
||||
@@ -12,45 +20,71 @@ class LoginPage extends StatelessWidget {
|
||||
TextEditingController username = TextEditingController();
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'Welcome!',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.displayMedium!
|
||||
.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
const Padding(padding: EdgeInsets.symmetric(vertical: 5)),
|
||||
Text('please enter your first name to get started',
|
||||
style: Theme.of(context).textTheme.bodyLarge),
|
||||
const Padding(padding: EdgeInsets.symmetric(vertical: 15)),
|
||||
TextField(
|
||||
controller: username,
|
||||
onSubmitted: (value) => DbHelper.login(username.text),
|
||||
textInputAction: TextInputAction.done,
|
||||
decoration: const InputDecoration(
|
||||
label: Text('Your first name'),
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const Padding(padding: EdgeInsets.symmetric(vertical: 15)),
|
||||
FloatingActionButton.extended(
|
||||
onPressed: () => DbHelper.login(username.text),
|
||||
label: const Text('READY'),
|
||||
)
|
||||
],
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: _height > 0 ? 0 : 300),
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 500),
|
||||
height: _height,
|
||||
width: 250,
|
||||
child: Image.asset('assets/images/maxio.png', height: _height),
|
||||
),
|
||||
),
|
||||
),
|
||||
Card(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: SizedBox(
|
||||
width: width,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Text(
|
||||
'Welcome!',
|
||||
style: Theme.of(context)
|
||||
.textTheme
|
||||
.displayMedium!
|
||||
.copyWith(fontWeight: FontWeight.bold),
|
||||
),
|
||||
const Padding(padding: EdgeInsets.symmetric(vertical: 5)),
|
||||
Text('please enter your first name to get started',
|
||||
style: Theme.of(context).textTheme.bodyLarge),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 15)),
|
||||
TextField(
|
||||
onTap: () => _onTap(),
|
||||
controller: username,
|
||||
onSubmitted: (value) => DbHelper.login(username.text),
|
||||
textInputAction: TextInputAction.done,
|
||||
decoration: const InputDecoration(
|
||||
label: Text('Your first name'),
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 15)),
|
||||
FloatingActionButton.extended(
|
||||
onPressed: () => DbHelper.login(username.text),
|
||||
label: const Text('READY'),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Padding(padding: EdgeInsets.only(top: 300)),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Future _onTap() async {
|
||||
setState(() {
|
||||
_height = 300;
|
||||
});
|
||||
await player.play(UrlSource(
|
||||
'https://vhmrtvhcmvylhrhblyjb.supabase.co/storage/v1/object/public/audio/itsMeMax.mp3'));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user