chore: Add code lint check for unused code
This commit is contained in:
parent
b4fbe46d43
commit
1896c56544
12 changed files with 36 additions and 352 deletions
|
|
@ -1,100 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fluffychat/config/themes.dart';
|
||||
|
||||
class AvatarPageHeader extends StatelessWidget {
|
||||
final Widget avatar;
|
||||
final void Function()? onAvatarEdit;
|
||||
final Widget? textButtonLeft, textButtonRight;
|
||||
final List<Widget> iconButtons;
|
||||
|
||||
const AvatarPageHeader({
|
||||
super.key,
|
||||
required this.avatar,
|
||||
this.onAvatarEdit,
|
||||
this.iconButtons = const [],
|
||||
this.textButtonLeft,
|
||||
this.textButtonRight,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final onAvatarEdit = this.onAvatarEdit;
|
||||
return Center(
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxWidth: FluffyThemes.columnWidth),
|
||||
child: Column(
|
||||
mainAxisSize: .min,
|
||||
crossAxisAlignment: .center,
|
||||
spacing: 8.0,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
avatar,
|
||||
if (onAvatarEdit != null)
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
child: FloatingActionButton.small(
|
||||
elevation: 2,
|
||||
onPressed: onAvatarEdit,
|
||||
heroTag: null,
|
||||
child: const Icon(Icons.camera_alt_outlined),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TextButtonTheme(
|
||||
data: TextButtonThemeData(
|
||||
style: TextButton.styleFrom(
|
||||
disabledForegroundColor: theme.colorScheme.onSurface,
|
||||
foregroundColor: theme.colorScheme.onSurface,
|
||||
textStyle: const TextStyle(fontWeight: FontWeight.normal),
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
return Row(
|
||||
mainAxisAlignment: .center,
|
||||
children: [
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: constraints.maxWidth / 2,
|
||||
),
|
||||
child: textButtonLeft,
|
||||
),
|
||||
ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: constraints.maxWidth / 2,
|
||||
),
|
||||
child: textButtonRight,
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
IconButtonTheme(
|
||||
data: IconButtonThemeData(
|
||||
style: IconButton.styleFrom(
|
||||
backgroundColor: theme.colorScheme.surfaceContainer,
|
||||
iconSize: 24,
|
||||
padding: const EdgeInsets.all(16),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: .spaceEvenly,
|
||||
children: iconButtons,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 0.0),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:fluffychat/utils/error_reporter.dart';
|
||||
|
||||
class FluffyChatErrorWidget extends StatefulWidget {
|
||||
final FlutterErrorDetails details;
|
||||
const FluffyChatErrorWidget(this.details, {super.key});
|
||||
|
||||
@override
|
||||
State<FluffyChatErrorWidget> createState() => _FluffyChatErrorWidgetState();
|
||||
}
|
||||
|
||||
class _FluffyChatErrorWidgetState extends State<FluffyChatErrorWidget> {
|
||||
static final Set<String> knownExceptions = {};
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
|
||||
if (knownExceptions.contains(widget.details.exception.toString())) {
|
||||
return;
|
||||
}
|
||||
knownExceptions.add(widget.details.exception.toString());
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
ErrorReporter(
|
||||
context,
|
||||
'Error Widget',
|
||||
).onErrorCallback(widget.details.exception, widget.details.stack);
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Material(
|
||||
color: Colors.orange,
|
||||
child: Placeholder(
|
||||
child: Center(
|
||||
child: Material(
|
||||
color: Colors.white.withAlpha(230),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue