Working auth and added shared notes
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rluv/global/styles.dart';
|
||||
|
||||
class CuteDrawerButton extends StatelessWidget {
|
||||
const CuteDrawerButton(
|
||||
{super.key,
|
||||
required this.text,
|
||||
required this.color,
|
||||
required this.onPressed});
|
||||
|
||||
final String text;
|
||||
final Function onPressed;
|
||||
final Color color;
|
||||
final double borderRadius = 12.0;
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
onTap: () => onPressed(),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: color,
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.black26,
|
||||
blurRadius: 2.0,
|
||||
spreadRadius: 2.0,
|
||||
offset: Offset(2.5, 2.5),
|
||||
)
|
||||
],
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
text,
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
color: Styles.washedStone,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rluv/global/styles.dart';
|
||||
import 'package:rluv/global/utils.dart';
|
||||
|
||||
class UiButton extends StatefulWidget {
|
||||
const UiButton({
|
||||
super.key,
|
||||
required this.text,
|
||||
this.color = Styles.deepPurpleNurple,
|
||||
required this.onPressed,
|
||||
this.height,
|
||||
this.width,
|
||||
this.icon,
|
||||
this.showLoading = false,
|
||||
});
|
||||
|
||||
final String text;
|
||||
final Function? onPressed;
|
||||
final Color color;
|
||||
final double? width;
|
||||
final double? height;
|
||||
final Icon? icon;
|
||||
final bool showLoading;
|
||||
|
||||
@override
|
||||
State<UiButton> createState() => _UiButtonState();
|
||||
}
|
||||
|
||||
class _UiButtonState extends State<UiButton> {
|
||||
final double borderRadius = 12.0;
|
||||
bool loading = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final computedColor =
|
||||
widget.onPressed == null ? Styles.disabledButton : widget.color;
|
||||
final brightness = getBrightness(computedColor);
|
||||
return SizedBox(
|
||||
width: widget.width,
|
||||
height: widget.height,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
onTap: widget.onPressed == null || loading
|
||||
? null
|
||||
: widget.showLoading
|
||||
? () async {
|
||||
setState(() => loading = true);
|
||||
await widget.onPressed!();
|
||||
setState(() => loading = false);
|
||||
}
|
||||
: () => widget.onPressed!(),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: computedColor,
|
||||
boxShadow: const [
|
||||
BoxShadow(
|
||||
color: Colors.black26,
|
||||
blurRadius: 2.0,
|
||||
spreadRadius: 2.0,
|
||||
offset: Offset(2.5, 2.5),
|
||||
)
|
||||
],
|
||||
borderRadius: BorderRadius.circular(borderRadius),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: loading
|
||||
? [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(4.0),
|
||||
child: SizedBox(
|
||||
height: 26,
|
||||
width: 26,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2.0,
|
||||
color: brightness == Brightness.dark
|
||||
? Styles.lavender
|
||||
: Styles.electricBlue)),
|
||||
),
|
||||
]
|
||||
: [
|
||||
if (widget.icon != null) widget.icon!,
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
widget.text,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: widget.onPressed == null
|
||||
? Styles.disabledButtonText
|
||||
: brightness == Brightness.dark
|
||||
? Styles.washedStone
|
||||
: Colors.black87,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user