config home editor pannel

This commit is contained in:
appflowy 2021-07-26 16:35:51 +08:00
parent a4f4066dfa
commit 6394ea2dd8
10 changed files with 105 additions and 37 deletions

View File

@ -123,7 +123,7 @@ class LoginButton extends StatelessWidget {
Widget build(BuildContext context) {
return RoundedTextButton(
title: 'Login',
height: 65,
height: 45,
borderRadius: BorderRadius.circular(10),
color: Colors.lightBlue,
press: () {

View File

@ -0,0 +1,16 @@
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
import 'package:flutter/material.dart';
AssetImage assetImageForViewType(ViewType type) {
final imageName = imageNameForViewType(type);
return AssetImage('assets/images/$imageName');
}
String imageNameForViewType(ViewType type) {
switch (type) {
case ViewType.Doc:
return "file_icon.jpg";
default:
return "file_icon.jpg";
}
}

View File

@ -32,7 +32,7 @@ class HomePageStack {
child: BlocBuilder<PageStackBloc, PageStackState>(
builder: (context, state) {
return HomeTopBar(
title: state.stackView.title,
view: state.stackView,
);
},
),

View File

@ -1,11 +1,9 @@
import 'package:app_flowy/workspace/presentation/view/view_widget.dart';
import 'package:flowy_infra/flowy_logger.dart';
import 'package:flowy_infra/size.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:dartz/dartz.dart';
import 'package:styled_widget/styled_widget.dart';
class ViewList extends StatelessWidget {
final Option<List<View>> views;

View File

@ -50,7 +50,9 @@ class EditorWdiget extends StatelessWidget {
scrollBottomInset: 0,
scrollController: ScrollController(),
);
return Expanded(child: editor);
return Expanded(
child: Padding(padding: const EdgeInsets.all(10), child: editor),
);
}
Widget _renderToolbar(EditorController controller) {

View File

@ -31,7 +31,8 @@ class HomeScreen extends StatelessWidget {
buildWhen: (previous, current) => previous != current,
builder: (context, state) {
return StyledContainer(
Theme.of(context).colorScheme.background,
Theme.of(context).colorScheme.surface,
// Colors.white,
child: _buildBody(
state, context.read<HomeBloc>().state.forceCollapse),
);

View File

@ -1,4 +1,5 @@
import 'package:app_flowy/startup/startup.dart';
import 'package:app_flowy/workspace/domain/image.dart';
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pb.dart';
@ -16,11 +17,11 @@ class ViewWidget extends StatelessWidget {
Row buildContent() {
return Row(
children: [
const Image(
Image(
fit: BoxFit.cover,
width: 20,
height: 20,
image: AssetImage('assets/images/file_icon.jpg')),
image: assetImageForViewType(view.viewType)),
const HSpace(6),
Text(
view.name,

View File

@ -1,20 +1,62 @@
import 'package:app_flowy/workspace/domain/image.dart';
import 'package:app_flowy/workspace/domain/page_stack/page_stack.dart';
import 'package:app_flowy/workspace/presentation/home/home_sizes.dart';
import 'package:flowy_infra_ui/widget/rounded_button.dart';
import 'package:flowy_infra_ui/widget/spacing.dart';
import 'package:flowy_sdk/protobuf/flowy-workspace/view_create.pbenum.dart';
import 'package:flutter/material.dart';
class HomeTopBar extends StatelessWidget {
final String title;
const HomeTopBar({Key? key, required this.title}) : super(key: key);
final HomeStackView view;
const HomeTopBar({Key? key, required this.view}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(horizontal: HomeInsets.topBarTitlePadding),
return SizedBox(
height: HomeSizes.topBarHeight,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
HomeTitle(title: title),
],
child: Container(
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(width: 0.5, color: Colors.grey.shade300),
),
),
child: Padding(
padding:
EdgeInsets.symmetric(horizontal: HomeInsets.topBarTitlePadding),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
HomeTitle(title: view.title, type: view.type),
const Spacer(),
_renderShareButton(),
_renderMoreButton(),
],
),
),
),
);
}
Widget _renderShareButton() {
return RoundedTextButton(
title: 'Share',
height: 30,
width: 60,
fontSize: 12,
borderRadius: BorderRadius.circular(6),
color: Colors.lightBlue,
press: () {},
);
}
Widget _renderMoreButton() {
return SizedBox(
width: 24,
child: IconButton(
icon: const Icon(Icons.more_vert),
iconSize: 12,
alignment: Alignment.center,
onPressed: () {},
),
);
}
@ -22,28 +64,32 @@ class HomeTopBar extends StatelessWidget {
class HomeTitle extends StatelessWidget {
final String title;
final _editingController = TextEditingController(
text: '',
);
final ViewType type;
HomeTitle({
const HomeTitle({
Key? key,
required this.title,
required this.type,
}) : super(key: key);
@override
Widget build(BuildContext context) {
_editingController.text = title;
return Expanded(
child: TextField(
controller: _editingController,
textAlign: TextAlign.left,
style: const TextStyle(fontSize: 28.0),
decoration: const InputDecoration(
hintText: 'Name the view',
border: UnderlineInputBorder(borderSide: BorderSide.none),
),
return Flexible(
child: Row(
children: [
Image(
fit: BoxFit.scaleDown,
width: 15,
height: 15,
image: assetImageForViewType(type)),
const HSpace(6),
Text(
title,
overflow: TextOverflow.fade,
softWrap: false,
style: const TextStyle(fontSize: 16),
),
],
),
);
}

View File

@ -39,7 +39,7 @@ class AppTheme {
switch (t) {
case ThemeType.light:
return AppTheme(isDark: false)
..bg1 = const Color(0xfff1f7f0)
..bg1 = const Color.fromARGB(255, 247, 248, 252)
..bg2 = const Color(0xffc1dcbc)
..surface = Colors.white
..accent1 = const Color(0xff00a086)

View File

@ -9,6 +9,7 @@ class RoundedTextButton extends StatelessWidget {
final Color borderColor;
final Color color;
final Color textColor;
final double fontSize;
const RoundedTextButton({
Key? key,
@ -20,19 +21,19 @@ class RoundedTextButton extends StatelessWidget {
this.borderColor = Colors.transparent,
this.color = Colors.transparent,
this.textColor = Colors.white,
this.fontSize = 16,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return ConstrainedBox(
constraints: BoxConstraints(
minWidth: 100,
minWidth: 10,
maxWidth: width ?? double.infinity,
minHeight: 50,
minHeight: 10,
maxHeight: height ?? 60,
),
child: Container(
margin: const EdgeInsets.symmetric(vertical: 10),
decoration: BoxDecoration(
border: Border.all(color: borderColor),
borderRadius: borderRadius,
@ -40,7 +41,10 @@ class RoundedTextButton extends StatelessWidget {
),
child: SizedBox.expand(
child: TextButton(
child: Text(title ?? '', style: TextStyle(color: textColor)),
child: Text(
title ?? '',
style: TextStyle(color: textColor, fontSize: fontSize),
),
onPressed: press,
),
),