mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
chore: delete placeholder code and clean code (#4503)
This commit is contained in:
parent
ca93cb20ec
commit
d117cd6b5b
@ -1,99 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:go_router/go_router.dart';
|
|
||||||
|
|
||||||
// TODO(yijing): delete this after implementing the real screen inside bottom navigation bar.
|
|
||||||
/// For demonstration purposes
|
|
||||||
class DetailsPlaceholderScreen extends StatefulWidget {
|
|
||||||
/// Constructs a [DetailsScreen].
|
|
||||||
const DetailsPlaceholderScreen({
|
|
||||||
required this.label,
|
|
||||||
this.param,
|
|
||||||
this.extra,
|
|
||||||
this.withScaffold = true,
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// The label to display in the center of the screen.
|
|
||||||
final String label;
|
|
||||||
|
|
||||||
/// Optional param
|
|
||||||
final String? param;
|
|
||||||
|
|
||||||
/// Optional extra object
|
|
||||||
final Object? extra;
|
|
||||||
|
|
||||||
/// Wrap in scaffold
|
|
||||||
final bool withScaffold;
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<StatefulWidget> createState() => DetailsPlaceholderScreenState();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The state for DetailsScreen
|
|
||||||
class DetailsPlaceholderScreenState extends State<DetailsPlaceholderScreen> {
|
|
||||||
int _counter = 0;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
if (widget.withScaffold) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
title: Text('Details Screen - ${widget.label}'),
|
|
||||||
),
|
|
||||||
body: _build(context),
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return Container(
|
|
||||||
color: Theme.of(context).scaffoldBackgroundColor,
|
|
||||||
child: _build(context),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _build(BuildContext context) {
|
|
||||||
return Center(
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: <Widget>[
|
|
||||||
Text(
|
|
||||||
'Details for ${widget.label} - Counter: $_counter',
|
|
||||||
style: Theme.of(context).textTheme.titleLarge,
|
|
||||||
),
|
|
||||||
const Padding(padding: EdgeInsets.all(4)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
setState(() {
|
|
||||||
_counter++;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
child: const Text('Increment counter'),
|
|
||||||
),
|
|
||||||
const Padding(padding: EdgeInsets.all(8)),
|
|
||||||
if (widget.param != null)
|
|
||||||
Text(
|
|
||||||
'Parameter: ${widget.param!}',
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
|
||||||
const Padding(padding: EdgeInsets.all(8)),
|
|
||||||
if (widget.extra != null)
|
|
||||||
Text(
|
|
||||||
'Extra: ${widget.extra!}',
|
|
||||||
style: Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
|
||||||
if (!widget.withScaffold) ...<Widget>[
|
|
||||||
const Padding(padding: EdgeInsets.all(16)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
GoRouter.of(context).pop();
|
|
||||||
},
|
|
||||||
child: const Text(
|
|
||||||
'< Back',
|
|
||||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 18),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -164,23 +164,23 @@ class _DeletedFilesListView extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
final object = state.objects[index];
|
final deletedFile = state.objects[index];
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 4),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
// TODO(Yijing): implement file type after TrashPB has file type
|
// TODO: show different file type icon, implement this feature after TrashPB has file type field
|
||||||
leading: FlowySvg(
|
leading: FlowySvg(
|
||||||
FlowySvgs.document_s,
|
FlowySvgs.document_s,
|
||||||
size: const Size.square(24),
|
size: const Size.square(24),
|
||||||
color: theme.colorScheme.onSurface,
|
color: theme.colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
title: Text(
|
title: Text(
|
||||||
object.name,
|
deletedFile.name,
|
||||||
style: theme.textTheme.labelMedium
|
style: theme.textTheme.labelMedium
|
||||||
?.copyWith(color: theme.colorScheme.onBackground),
|
?.copyWith(color: theme.colorScheme.onBackground),
|
||||||
),
|
),
|
||||||
horizontalTitleGap: 0,
|
horizontalTitleGap: 0,
|
||||||
// TODO(yiing): needs improve by container/surface theme color
|
|
||||||
tileColor: theme.colorScheme.onSurface.withOpacity(0.1),
|
tileColor: theme.colorScheme.onSurface.withOpacity(0.1),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
@ -188,7 +188,6 @@ class _DeletedFilesListView extends StatelessWidget {
|
|||||||
trailing: Row(
|
trailing: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
// TODO(yijing): extract icon button
|
|
||||||
IconButton(
|
IconButton(
|
||||||
splashRadius: 20,
|
splashRadius: 20,
|
||||||
icon: FlowySvg(
|
icon: FlowySvg(
|
||||||
@ -199,10 +198,10 @@ class _DeletedFilesListView extends StatelessWidget {
|
|||||||
onPressed: () {
|
onPressed: () {
|
||||||
context
|
context
|
||||||
.read<TrashBloc>()
|
.read<TrashBloc>()
|
||||||
.add(TrashEvent.putback(object.id));
|
.add(TrashEvent.putback(deletedFile.id));
|
||||||
Fluttertoast.showToast(
|
Fluttertoast.showToast(
|
||||||
msg:
|
msg:
|
||||||
'${object.name} ${LocaleKeys.trash_mobile_isRestored.tr()}',
|
'${deletedFile.name} ${LocaleKeys.trash_mobile_isRestored.tr()}',
|
||||||
gravity: ToastGravity.BOTTOM,
|
gravity: ToastGravity.BOTTOM,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -215,10 +214,12 @@ class _DeletedFilesListView extends StatelessWidget {
|
|||||||
color: theme.colorScheme.onSurface,
|
color: theme.colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
context.read<TrashBloc>().add(TrashEvent.delete(object));
|
context
|
||||||
|
.read<TrashBloc>()
|
||||||
|
.add(TrashEvent.delete(deletedFile));
|
||||||
Fluttertoast.showToast(
|
Fluttertoast.showToast(
|
||||||
msg:
|
msg:
|
||||||
'${object.name} ${LocaleKeys.trash_mobile_isDeleted.tr()}',
|
'${deletedFile.name} ${LocaleKeys.trash_mobile_isDeleted.tr()}',
|
||||||
gravity: ToastGravity.BOTTOM,
|
gravity: ToastGravity.BOTTOM,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
export 'details_placeholder_page.dart';
|
|
||||||
export 'editor/mobile_editor_screen.dart';
|
export 'editor/mobile_editor_screen.dart';
|
||||||
export 'home/home.dart';
|
export 'home/home.dart';
|
||||||
export 'mobile_bottom_navigation_bar.dart';
|
export 'mobile_bottom_navigation_bar.dart';
|
||||||
|
@ -15,7 +15,7 @@ class NotificationsSettingGroup extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _NotificationsSettingGroupState extends State<NotificationsSettingGroup> {
|
class _NotificationsSettingGroupState extends State<NotificationsSettingGroup> {
|
||||||
// TODO(yijing):remove this after notification page is implemented
|
// TODO:remove this after notification page is implemented
|
||||||
bool isPushNotificationOn = false;
|
bool isPushNotificationOn = false;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -8,7 +8,7 @@ import 'package:flowy_infra_ui/widget/error_page.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
|
|
||||||
// TODO(yijing): needs refactor when multiple workspaces are supported
|
// TODO: needs refactor when multiple workspaces are supported
|
||||||
class MobileWorkspaceStartScreen extends StatefulWidget {
|
class MobileWorkspaceStartScreen extends StatefulWidget {
|
||||||
const MobileWorkspaceStartScreen({
|
const MobileWorkspaceStartScreen({
|
||||||
super.key,
|
super.key,
|
||||||
@ -64,7 +64,7 @@ class _MobileWorkspaceStartScreenState
|
|||||||
const VSpace(spacing * 4),
|
const VSpace(spacing * 4),
|
||||||
DropdownMenu<WorkspacePB>(
|
DropdownMenu<WorkspacePB>(
|
||||||
width: size.width - 100,
|
width: size.width - 100,
|
||||||
// TODO(yijing): The following code cause the bad state error, need to fix it
|
// TODO: The following code cause the bad state error, need to fix it
|
||||||
// initialSelection: widget.workspaceState.workspaces.first,
|
// initialSelection: widget.workspaceState.workspaces.first,
|
||||||
label: const Text('Workspace'),
|
label: const Text('Workspace'),
|
||||||
controller: controller,
|
controller: controller,
|
||||||
@ -76,7 +76,7 @@ class _MobileWorkspaceStartScreenState
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
const Spacer(),
|
const Spacer(),
|
||||||
// TODO(yijing): needs to implement create workspace in the future
|
// TODO: needs to implement create workspace in the future
|
||||||
// TextButton(
|
// TextButton(
|
||||||
// child: Text(
|
// child: Text(
|
||||||
// LocaleKeys.workspace_create.tr(),
|
// LocaleKeys.workspace_create.tr(),
|
||||||
|
@ -64,7 +64,6 @@ class MobileAppearance extends BaseAppearance {
|
|||||||
brightness: brightness,
|
brightness: brightness,
|
||||||
primary: _primaryColor,
|
primary: _primaryColor,
|
||||||
onPrimary: Colors.black,
|
onPrimary: Colors.black,
|
||||||
// TODO(yijing): add color later
|
|
||||||
secondary: const Color(0xff2d2d2d), //temp
|
secondary: const Color(0xff2d2d2d), //temp
|
||||||
onSecondary: Colors.white,
|
onSecondary: Colors.white,
|
||||||
tertiary: const Color(0xff858585), // temp
|
tertiary: const Color(0xff858585), // temp
|
||||||
|
Loading…
x
Reference in New Issue
Block a user