mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-11 18:39:45 +00:00
Delete unused UI components.
This commit is contained in:
parent
31624a3412
commit
1a17f73df4
|
@ -1,63 +0,0 @@
|
||||||
// import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
// var navigatorKey = GlobalKey<NavigatorState>();
|
|
||||||
|
|
||||||
// class BrandModalSheet extends StatelessWidget {
|
|
||||||
// const BrandModalSheet({
|
|
||||||
// Key? key,
|
|
||||||
// this.child,
|
|
||||||
// }) : super(key: key);
|
|
||||||
|
|
||||||
// final Widget? child;
|
|
||||||
// @override
|
|
||||||
// Widget build(BuildContext context) {
|
|
||||||
// return DraggableScrollableSheet(
|
|
||||||
// minChildSize: 1,
|
|
||||||
// initialChildSize: 1,
|
|
||||||
// maxChildSize: 1,
|
|
||||||
// builder: (context, scrollController) {
|
|
||||||
// return SingleChildScrollView(
|
|
||||||
// controller: scrollController,
|
|
||||||
// physics: ClampingScrollPhysics(),
|
|
||||||
// child: Container(
|
|
||||||
// child: Column(
|
|
||||||
// children: [
|
|
||||||
// GestureDetector(
|
|
||||||
// onTap: () => Navigator.of(context).pop(),
|
|
||||||
// behavior: HitTestBehavior.opaque,
|
|
||||||
// child: Container(
|
|
||||||
// width: double.infinity,
|
|
||||||
// child: Center(
|
|
||||||
// child: Padding(
|
|
||||||
// padding: EdgeInsets.only(top: 132, bottom: 6),
|
|
||||||
// child: Container(
|
|
||||||
// height: 4,
|
|
||||||
// width: 30,
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// borderRadius: BorderRadius.circular(2),
|
|
||||||
// color: Color(0xFFE3E3E3).withOpacity(0.65),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// Container(
|
|
||||||
// constraints: BoxConstraints(
|
|
||||||
// minHeight: MediaQuery.of(context).size.height - 132,
|
|
||||||
// maxHeight: MediaQuery.of(context).size.height - 132,
|
|
||||||
// ),
|
|
||||||
// decoration: BoxDecoration(
|
|
||||||
// borderRadius:
|
|
||||||
// BorderRadius.vertical(top: Radius.circular(20)),
|
|
||||||
// color: Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
// ),
|
|
||||||
// width: double.infinity,
|
|
||||||
// child: child),
|
|
||||||
// ],
|
|
||||||
// ),
|
|
||||||
// ),
|
|
||||||
// );
|
|
||||||
// });
|
|
||||||
// }
|
|
||||||
// }
|
|
|
@ -1,6 +1,8 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:selfprivacy/config/brand_colors.dart';
|
import 'package:selfprivacy/config/brand_colors.dart';
|
||||||
|
|
||||||
|
// TODO: Delete this file.
|
||||||
|
|
||||||
class BrandRadio extends StatelessWidget {
|
class BrandRadio extends StatelessWidget {
|
||||||
const BrandRadio({
|
const BrandRadio({
|
||||||
required this.isChecked,
|
required this.isChecked,
|
||||||
|
|
|
@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_radio/brand_radio.dart';
|
import 'package:selfprivacy/ui/components/brand_radio/brand_radio.dart';
|
||||||
import 'package:selfprivacy/ui/components/brand_text/brand_text.dart';
|
import 'package:selfprivacy/ui/components/brand_text/brand_text.dart';
|
||||||
|
|
||||||
|
// TODO: Delete this file
|
||||||
|
|
||||||
class BrandRadioTile extends StatelessWidget {
|
class BrandRadioTile extends StatelessWidget {
|
||||||
const BrandRadioTile({
|
const BrandRadioTile({
|
||||||
required this.isChecked,
|
required this.isChecked,
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
import 'package:flutter/gestures.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:selfprivacy/config/brand_colors.dart';
|
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
|
||||||
|
|
||||||
class BrandSpanButton extends TextSpan {
|
|
||||||
BrandSpanButton({
|
|
||||||
required final String text,
|
|
||||||
required final VoidCallback onTap,
|
|
||||||
final TextStyle? style,
|
|
||||||
}) : super(
|
|
||||||
recognizer: TapGestureRecognizer()..onTap = onTap,
|
|
||||||
text: text,
|
|
||||||
style: (style ?? const TextStyle()).copyWith(color: BrandColors.blue),
|
|
||||||
);
|
|
||||||
|
|
||||||
BrandSpanButton.link({
|
|
||||||
required final String text,
|
|
||||||
final String? urlString,
|
|
||||||
final TextStyle? style,
|
|
||||||
}) : super(
|
|
||||||
recognizer: TapGestureRecognizer()
|
|
||||||
..onTap = () => _launchURL(urlString ?? text),
|
|
||||||
text: text,
|
|
||||||
style: (style ?? const TextStyle()).copyWith(color: BrandColors.blue),
|
|
||||||
);
|
|
||||||
|
|
||||||
static Future<void> _launchURL(final String link) async {
|
|
||||||
if (await canLaunchUrl(Uri.parse(link))) {
|
|
||||||
await launchUrl(Uri.parse(link));
|
|
||||||
} else {
|
|
||||||
throw 'Could not launch $link';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -2,6 +2,8 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:selfprivacy/config/text_themes.dart';
|
import 'package:selfprivacy/config/text_themes.dart';
|
||||||
export 'package:selfprivacy/utils/extensions/text_extensions.dart';
|
export 'package:selfprivacy/utils/extensions/text_extensions.dart';
|
||||||
|
|
||||||
|
// TODO: Delete this file
|
||||||
|
|
||||||
enum TextType {
|
enum TextType {
|
||||||
h1, // right now only at onboarding and opened providers
|
h1, // right now only at onboarding and opened providers
|
||||||
h2, // cards titles
|
h2, // cards titles
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:selfprivacy/config/brand_colors.dart';
|
|
||||||
|
|
||||||
class DotsIndicator extends StatelessWidget {
|
|
||||||
const DotsIndicator({
|
|
||||||
required this.activeIndex,
|
|
||||||
required this.count,
|
|
||||||
final super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
final int activeIndex;
|
|
||||||
final int count;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(final BuildContext context) {
|
|
||||||
final List<Container> dots = List.generate(
|
|
||||||
count,
|
|
||||||
(final index) => Container(
|
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 5, vertical: 10),
|
|
||||||
height: 10,
|
|
||||||
width: 10,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: index == activeIndex ? BrandColors.blue : BrandColors.gray2,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: dots,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,19 +0,0 @@
|
||||||
part of 'pre_styled_buttons.dart';
|
|
||||||
|
|
||||||
class _CloseButton extends StatelessWidget {
|
|
||||||
const _CloseButton({required this.onPress});
|
|
||||||
|
|
||||||
final VoidCallback onPress;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(final BuildContext context) => OutlinedButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
child: Row(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: [
|
|
||||||
BrandText.h4('basis.close'.tr()),
|
|
||||||
const Icon(Icons.close),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,87 +0,0 @@
|
||||||
part of 'pre_styled_buttons.dart';
|
|
||||||
|
|
||||||
class _BrandFlashButton extends StatefulWidget {
|
|
||||||
@override
|
|
||||||
_BrandFlashButtonState createState() => _BrandFlashButtonState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _BrandFlashButtonState extends State<_BrandFlashButton>
|
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
late AnimationController _animationController;
|
|
||||||
late Animation _colorTween;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
_animationController = AnimationController(
|
|
||||||
vsync: this,
|
|
||||||
duration: const Duration(milliseconds: 800),
|
|
||||||
);
|
|
||||||
_colorTween = ColorTween(
|
|
||||||
begin: BrandColors.black,
|
|
||||||
end: BrandColors.primary,
|
|
||||||
).animate(_animationController);
|
|
||||||
|
|
||||||
super.initState();
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback(_afterLayout);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _afterLayout(final _) {
|
|
||||||
if (Theme.of(context).brightness == Brightness.dark) {
|
|
||||||
setState(() {
|
|
||||||
_colorTween = ColorTween(
|
|
||||||
begin: BrandColors.white,
|
|
||||||
end: BrandColors.primary,
|
|
||||||
).animate(_animationController);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
_animationController.dispose();
|
|
||||||
super.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool wasPrevStateIsEmpty = true;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(final BuildContext context) =>
|
|
||||||
BlocListener<JobsCubit, JobsState>(
|
|
||||||
listener: (final context, final state) {
|
|
||||||
if (wasPrevStateIsEmpty && state is! JobsStateEmpty) {
|
|
||||||
wasPrevStateIsEmpty = false;
|
|
||||||
_animationController.forward();
|
|
||||||
} else if (!wasPrevStateIsEmpty && state is JobsStateEmpty) {
|
|
||||||
wasPrevStateIsEmpty = true;
|
|
||||||
|
|
||||||
_animationController.reverse();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: () {
|
|
||||||
showBrandBottomSheet(
|
|
||||||
context: context,
|
|
||||||
builder: (final context) => const BrandBottomSheet(
|
|
||||||
isExpended: true,
|
|
||||||
child: JobsContent(),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
icon: AnimatedBuilder(
|
|
||||||
animation: _colorTween,
|
|
||||||
builder: (final context, final child) {
|
|
||||||
final double v = _animationController.value;
|
|
||||||
final IconData icon =
|
|
||||||
v > 0.5 ? Ionicons.flash : Ionicons.flash_outline;
|
|
||||||
return Transform.scale(
|
|
||||||
scale: 1 + (v < 0.5 ? v : 1 - v) * 2,
|
|
||||||
child: Icon(
|
|
||||||
icon,
|
|
||||||
color: _colorTween.value,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -55,6 +55,7 @@ class _BrandFabState extends State<BrandFab>
|
||||||
},
|
},
|
||||||
child: FloatingActionButton(
|
child: FloatingActionButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
// TODO: Make a hero animation to the screen
|
||||||
showBrandBottomSheet(
|
showBrandBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
builder: (final BuildContext context) => const BrandBottomSheet(
|
builder: (final BuildContext context) => const BrandBottomSheet(
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
||||||
import 'package:ionicons/ionicons.dart';
|
|
||||||
import 'package:selfprivacy/config/brand_colors.dart';
|
|
||||||
import 'package:selfprivacy/logic/cubit/client_jobs/client_jobs_cubit.dart';
|
|
||||||
import 'package:selfprivacy/ui/components/brand_bottom_sheet/brand_bottom_sheet.dart';
|
|
||||||
import 'package:selfprivacy/ui/components/brand_text/brand_text.dart';
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
|
||||||
import 'package:selfprivacy/ui/components/jobs_content/jobs_content.dart';
|
|
||||||
import 'package:selfprivacy/ui/helpers/modals.dart';
|
|
||||||
|
|
||||||
part 'close.dart';
|
|
||||||
part 'flash.dart';
|
|
||||||
|
|
||||||
class PreStyledButtons {
|
|
||||||
static Widget close({
|
|
||||||
required final VoidCallback onPress,
|
|
||||||
}) =>
|
|
||||||
_CloseButton(onPress: onPress);
|
|
||||||
|
|
||||||
static Widget flash() => _BrandFlashButton();
|
|
||||||
}
|
|
|
@ -1,32 +0,0 @@
|
||||||
library elevation_extension;
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter/cupertino.dart';
|
|
||||||
|
|
||||||
extension ElevationExtension on BoxDecoration {
|
|
||||||
BoxDecoration copyWith({
|
|
||||||
final Color? color,
|
|
||||||
final DecorationImage? image,
|
|
||||||
final BoxBorder? border,
|
|
||||||
final BorderRadiusGeometry? borderRadius,
|
|
||||||
final List<BoxShadow>? boxShadow,
|
|
||||||
final Gradient? gradient,
|
|
||||||
final BlendMode? backgroundBlendMode,
|
|
||||||
final BoxShape? shape,
|
|
||||||
}) =>
|
|
||||||
BoxDecoration(
|
|
||||||
color: color ?? this.color,
|
|
||||||
image: image ?? this.image,
|
|
||||||
border: border ?? this.border,
|
|
||||||
borderRadius: borderRadius ?? this.borderRadius,
|
|
||||||
boxShadow: this.boxShadow != null || boxShadow != null
|
|
||||||
? <BoxShadow>[
|
|
||||||
...this.boxShadow ?? <BoxShadow>[],
|
|
||||||
...boxShadow ?? <BoxShadow>[]
|
|
||||||
]
|
|
||||||
: null,
|
|
||||||
gradient: gradient ?? this.gradient,
|
|
||||||
backgroundBlendMode: backgroundBlendMode ?? this.backgroundBlendMode,
|
|
||||||
shape: shape ?? this.shape,
|
|
||||||
);
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
Function pageBuilder = (final Widget widget) => (
|
|
||||||
final BuildContext context,
|
|
||||||
final Animation<double> animation,
|
|
||||||
final Animation<double> secondaryAnimation,
|
|
||||||
) =>
|
|
||||||
widget;
|
|
||||||
|
|
||||||
Function transitionsBuilder = (
|
|
||||||
final BuildContext context,
|
|
||||||
final Animation<double> animation,
|
|
||||||
final Animation<double> secondaryAnimation,
|
|
||||||
final Widget child,
|
|
||||||
) =>
|
|
||||||
SlideTransition(
|
|
||||||
position: Tween<Offset>(
|
|
||||||
begin: const Offset(0, 1),
|
|
||||||
end: Offset.zero,
|
|
||||||
).animate(animation),
|
|
||||||
child: Container(
|
|
||||||
decoration: animation.isCompleted
|
|
||||||
? null
|
|
||||||
: const BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
bottom: BorderSide(
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: child,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
class SlideBottomRoute extends PageRouteBuilder {
|
|
||||||
SlideBottomRoute(this.widget)
|
|
||||||
: super(
|
|
||||||
transitionDuration: const Duration(milliseconds: 150),
|
|
||||||
pageBuilder: pageBuilder(widget),
|
|
||||||
transitionsBuilder: transitionsBuilder as Widget Function(
|
|
||||||
BuildContext,
|
|
||||||
Animation<double>,
|
|
||||||
Animation<double>,
|
|
||||||
Widget,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final Widget widget;
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
Function pageBuilder = (final Widget widget) => (
|
|
||||||
final BuildContext context,
|
|
||||||
final Animation<double> animation,
|
|
||||||
final Animation<double> secondaryAnimation,
|
|
||||||
) =>
|
|
||||||
widget;
|
|
||||||
|
|
||||||
Function transitionsBuilder = (
|
|
||||||
final BuildContext context,
|
|
||||||
final Animation<double> animation,
|
|
||||||
final Animation<double> secondaryAnimation,
|
|
||||||
final Widget child,
|
|
||||||
) =>
|
|
||||||
SlideTransition(
|
|
||||||
position: Tween<Offset>(
|
|
||||||
begin: const Offset(-1, 0),
|
|
||||||
end: Offset.zero,
|
|
||||||
).animate(animation),
|
|
||||||
child: Container(
|
|
||||||
decoration: animation.isCompleted
|
|
||||||
? null
|
|
||||||
: const BoxDecoration(
|
|
||||||
border: Border(
|
|
||||||
right: BorderSide(
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: child,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
class SlideRightRoute extends PageRouteBuilder {
|
|
||||||
SlideRightRoute(this.widget)
|
|
||||||
: super(
|
|
||||||
pageBuilder: pageBuilder(widget),
|
|
||||||
transitionsBuilder: transitionsBuilder as Widget Function(
|
|
||||||
BuildContext,
|
|
||||||
Animation<double>,
|
|
||||||
Animation<double>,
|
|
||||||
Widget,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
final Widget widget;
|
|
||||||
}
|
|
Loading…
Reference in a new issue