mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-16 10:46:00 -07:00
Init repo
This commit is contained in:
commit
764b6034e3
566 changed files with 212335 additions and 0 deletions
97
lib/screens/login/widgets/login_icon.dart
Normal file
97
lib/screens/login/widgets/login_icon.dart
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
import 'package:fladder/models/account_model.dart';
|
||||
import 'package:fladder/screens/shared/flat_button.dart';
|
||||
import 'package:fladder/screens/shared/user_icon.dart';
|
||||
import 'package:fladder/util/list_padding.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class LoginIcon extends ConsumerWidget {
|
||||
final AccountModel user;
|
||||
final Function()? onPressed;
|
||||
final Function()? onLongPress;
|
||||
final Function()? onNewPressed;
|
||||
const LoginIcon({
|
||||
required this.user,
|
||||
this.onPressed,
|
||||
this.onLongPress,
|
||||
this.onNewPressed,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return AspectRatio(
|
||||
aspectRatio: 1.0,
|
||||
child: Card(
|
||||
elevation: 1,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
margin: EdgeInsets.zero,
|
||||
child: Stack(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: UserIcon(
|
||||
labelStyle: Theme.of(context).textTheme.displayMedium,
|
||||
size: const Size(125, 125),
|
||||
user: user,
|
||||
),
|
||||
),
|
||||
Flexible(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
if (onNewPressed != null)
|
||||
Icon(
|
||||
user.authMethod.icon,
|
||||
size: 26,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
user.name,
|
||||
maxLines: 2,
|
||||
style: Theme.of(context).textTheme.titleLarge,
|
||||
softWrap: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (user.credentials.serverName.isNotEmpty)
|
||||
Flexible(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(
|
||||
Icons.dns_rounded,
|
||||
size: 14,
|
||||
),
|
||||
const SizedBox(width: 4),
|
||||
Flexible(
|
||||
child: Text(
|
||||
user.credentials.serverName,
|
||||
maxLines: 2,
|
||||
softWrap: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
].addInBetween(SizedBox(width: 8, height: 8)),
|
||||
),
|
||||
),
|
||||
FlatButton(
|
||||
onTap: onPressed,
|
||||
onLongPress: onLongPress,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue