This commit is contained in:
Nopylacetat
2023-10-21 13:17:37 +02:00
parent 9c08cab231
commit efee307130
5 changed files with 171 additions and 43 deletions

BIN
assets/images/maxio.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

View File

@@ -22,10 +22,19 @@ class _FeedPageState extends State<FeedPage> {
return Card( return Card(
child: ListTile( child: ListTile(
title: Text(feedItem.text), title: Text(feedItem.text),
subtitle: Text(getTimeString(feedItem.timestamp)), trailing: Row(
trailing: Text( mainAxisSize: MainAxisSize.min,
'${feedItem.timestamp.hour}:${feedItem.timestamp.minute}', mainAxisAlignment: MainAxisAlignment.end,
style: Theme.of(context).textTheme.bodyLarge!.copyWith(), 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) { } else if (duration.inDays > 1) {
return '${duration.inDays} days ago'; return '${duration.inDays} days ago';
} else if (duration.inHours > 0) { } 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) { } else if (duration.inMinutes > 0) {
return '${duration.inMinutes} minutes ago'; String text = duration.inMinutes == 1 ? 'minute' : 'minutes';
return '${duration.inMinutes} $text ago';
} else { } else {
return 'just seconds ago'; return 'just seconds ago';
} }

View File

@@ -1,10 +1,18 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:audioplayers/audioplayers.dart';
import '../services/db_helper.dart'; import '../services/db_helper.dart';
class LoginPage extends StatelessWidget { class LoginPage extends StatefulWidget {
const LoginPage({super.key}); const LoginPage({super.key});
@override
State<LoginPage> createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
double _height = 0;
final player = AudioPlayer();
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double width = MediaQuery.of(context).size.width / 2; double width = MediaQuery.of(context).size.width / 2;
@@ -12,45 +20,71 @@ class LoginPage extends StatelessWidget {
TextEditingController username = TextEditingController(); TextEditingController username = TextEditingController();
return Scaffold( return Scaffold(
body: Center( body: Center(
child: Card( child: Column(
child: Padding( mainAxisSize: MainAxisSize.min,
padding: const EdgeInsets.all(15.0), children: [
child: SizedBox( Padding(
width: width, padding: EdgeInsets.only(top: _height > 0 ? 0 : 300),
child: Column( child: AnimatedContainer(
mainAxisSize: MainAxisSize.min, duration: const Duration(milliseconds: 500),
children: [ height: _height,
Text( width: 250,
'Welcome!', child: Image.asset('assets/images/maxio.png', height: _height),
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'),
)
],
), ),
), ),
), 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'));
}
} }

View File

@@ -17,6 +17,62 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.11.0" version: "2.11.0"
audioplayers:
dependency: "direct main"
description:
name: audioplayers
sha256: d9f6ca8e9b3e5af5e73d4c814404566f72698ee7ba35487bdf2baa6749e7503f
url: "https://pub.dev"
source: hosted
version: "5.2.0"
audioplayers_android:
dependency: transitive
description:
name: audioplayers_android
sha256: fb01b9481f431fe04ac60f1f97ce8158383f2dc754558820592f795d81ca9d53
url: "https://pub.dev"
source: hosted
version: "4.0.2"
audioplayers_darwin:
dependency: transitive
description:
name: audioplayers_darwin
sha256: "3034e99a6df8d101da0f5082dcca0a2a99db62ab1d4ddb3277bed3f6f81afe08"
url: "https://pub.dev"
source: hosted
version: "5.0.2"
audioplayers_linux:
dependency: transitive
description:
name: audioplayers_linux
sha256: "60787e73fefc4d2e0b9c02c69885402177e818e4e27ef087074cf27c02246c9e"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
audioplayers_platform_interface:
dependency: transitive
description:
name: audioplayers_platform_interface
sha256: "365c547f1bb9e77d94dd1687903a668d8f7ac3409e48e6e6a3668a1ac2982adb"
url: "https://pub.dev"
source: hosted
version: "6.1.0"
audioplayers_web:
dependency: transitive
description:
name: audioplayers_web
sha256: "22cd0173e54d92bd9b2c80b1204eb1eb159ece87475ab58c9788a70ec43c2a62"
url: "https://pub.dev"
source: hosted
version: "4.1.0"
audioplayers_windows:
dependency: transitive
description:
name: audioplayers_windows
sha256: "9536812c9103563644ada2ef45ae523806b0745f7a78e89d1b5fb1951de90e1a"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
@@ -429,6 +485,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.10.0" version: "1.10.0"
sprintf:
dependency: transitive
description:
name: sprintf
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
stack_trace: stack_trace:
dependency: transitive dependency: transitive
description: description:
@@ -477,6 +541,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.10.22" version: "1.10.22"
synchronized:
dependency: transitive
description:
name: synchronized
sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@@ -565,6 +637,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "3.0.8" version: "3.0.8"
uuid:
dependency: transitive
description:
name: uuid
sha256: b715b8d3858b6fa9f68f87d20d98830283628014750c2b09b6f516c1da4af2a7
url: "https://pub.dev"
source: hosted
version: "4.1.0"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:

View File

@@ -15,6 +15,7 @@ dependencies:
shared_preferences: ^2.2.2 shared_preferences: ^2.2.2
provider: ^6.0.5 provider: ^6.0.5
supabase_flutter: ^1.10.22 supabase_flutter: ^1.10.22
audioplayers: ^5.2.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@@ -23,6 +24,8 @@ dev_dependencies:
flutter_lints: ^3.0.0 flutter_lints: ^3.0.0
flutter: flutter:
uses-material-design: true uses-material-design: true
assets:
- assets/images/maxio.png
fonts: fonts:
- family: Ubuntu - family: Ubuntu
fonts: fonts: