mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: refacotor share menu UI
This commit is contained in:
parent
701b55dc45
commit
95c4da5e6f
@ -98,7 +98,13 @@ class _PublishedWidgetState extends State<_PublishedWidget> {
|
|||||||
const VSpace(16),
|
const VSpace(16),
|
||||||
_PublishUrl(
|
_PublishUrl(
|
||||||
controller: controller,
|
controller: controller,
|
||||||
onCopy: (url) {},
|
onCopy: (url) {
|
||||||
|
AppFlowyClipboard.setData(text: url);
|
||||||
|
showSnackBarMessage(
|
||||||
|
context,
|
||||||
|
LocaleKeys.document_inlineLink_copyLink.tr(),
|
||||||
|
);
|
||||||
|
},
|
||||||
onSubmitted: (url) {},
|
onSubmitted: (url) {},
|
||||||
),
|
),
|
||||||
const VSpace(16),
|
const VSpace(16),
|
||||||
@ -138,13 +144,14 @@ class _PublishedWidgetState extends State<_PublishedWidget> {
|
|||||||
}) {
|
}) {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 36,
|
height: 36,
|
||||||
width: 189,
|
width: 184,
|
||||||
child: FlowyButton(
|
child: FlowyButton(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: backgroundColor,
|
color: backgroundColor,
|
||||||
borderRadius: BorderRadius.circular(10),
|
borderRadius: BorderRadius.circular(10),
|
||||||
border: Border.all(color: borderColor),
|
border: Border.all(color: borderColor),
|
||||||
),
|
),
|
||||||
|
radius: BorderRadius.circular(10),
|
||||||
text: FlowyText.regular(
|
text: FlowyText.regular(
|
||||||
name,
|
name,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
@ -229,6 +236,7 @@ class _PublishUrl extends StatelessWidget {
|
|||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: 36,
|
height: 36,
|
||||||
child: FlowyTextField(
|
child: FlowyTextField(
|
||||||
|
readOnly: true,
|
||||||
autoFocus: false,
|
autoFocus: false,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
suffixIcon: _buildCopyLinkIcon(),
|
suffixIcon: _buildCopyLinkIcon(),
|
||||||
|
@ -52,7 +52,6 @@ class DocumentShareButton extends StatelessWidget {
|
|||||||
constraints: const BoxConstraints(
|
constraints: const BoxConstraints(
|
||||||
maxWidth: 422,
|
maxWidth: 422,
|
||||||
),
|
),
|
||||||
margin: const EdgeInsets.all(16),
|
|
||||||
offset: const Offset(0, 8),
|
offset: const Offset(0, 8),
|
||||||
popupBuilder: (context) => BlocProvider.value(
|
popupBuilder: (context) => BlocProvider.value(
|
||||||
value: shareBloc,
|
value: shareBloc,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||||
import 'package:appflowy/util/theme_extension.dart';
|
import 'package:appflowy/mobile/presentation/home/tab/_round_underline_tab_indicator.dart';
|
||||||
import 'package:custom_sliding_segmented_control/custom_sliding_segmented_control.dart';
|
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -13,7 +12,7 @@ enum ShareMenuTab {
|
|||||||
exportAs;
|
exportAs;
|
||||||
|
|
||||||
static List<ShareMenuTab> supportedTabs = [
|
static List<ShareMenuTab> supportedTabs = [
|
||||||
ShareMenuTab.share,
|
// ShareMenuTab.share,
|
||||||
ShareMenuTab.publish,
|
ShareMenuTab.publish,
|
||||||
ShareMenuTab.exportAs,
|
ShareMenuTab.exportAs,
|
||||||
];
|
];
|
||||||
@ -37,60 +36,75 @@ class ShareMenu extends StatefulWidget {
|
|||||||
State<ShareMenu> createState() => _ShareMenuState();
|
State<ShareMenu> createState() => _ShareMenuState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ShareMenuState extends State<ShareMenu> {
|
class _ShareMenuState extends State<ShareMenu>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
ShareMenuTab selectedTab = ShareMenuTab.publish;
|
ShareMenuTab selectedTab = ShareMenuTab.publish;
|
||||||
|
late final tabController = TabController(
|
||||||
|
length: ShareMenuTab.supportedTabs.length,
|
||||||
|
vsync: this,
|
||||||
|
initialIndex: ShareMenuTab.supportedTabs.indexOf(selectedTab),
|
||||||
|
);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final children = {
|
|
||||||
for (final tab in ShareMenuTab.supportedTabs)
|
|
||||||
tab: _Segment(
|
|
||||||
title: tab.i18n.tr(),
|
|
||||||
isSelected: selectedTab == tab,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
final color = Theme.of(context).isLightMode
|
|
||||||
? const Color(0xFFEEF0F3)
|
|
||||||
: Colors.black.withOpacity(0.3);
|
|
||||||
final thumbColor = Theme.of(context).isLightMode
|
|
||||||
? Colors.white
|
|
||||||
: Theme.of(context).colorScheme.secondary;
|
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
SizedBox(
|
const VSpace(10),
|
||||||
height: 34,
|
Container(
|
||||||
child: CustomSlidingSegmentedControl<ShareMenuTab>(
|
alignment: Alignment.centerLeft,
|
||||||
initialValue: selectedTab,
|
height: 30,
|
||||||
curve: Curves.linear,
|
child: _buildTabBar(context),
|
||||||
padding: 0,
|
),
|
||||||
fixedWidth: 128,
|
Divider(
|
||||||
innerPadding: const EdgeInsets.all(3.0),
|
color: Theme.of(context).dividerColor,
|
||||||
children: children,
|
height: 1,
|
||||||
decoration: BoxDecoration(
|
thickness: 1,
|
||||||
color: color,
|
),
|
||||||
borderRadius: BorderRadius.circular(8),
|
Padding(
|
||||||
),
|
padding: const EdgeInsets.symmetric(horizontal: 14.0),
|
||||||
thumbDecoration: BoxDecoration(
|
child: _buildTab(context),
|
||||||
color: thumbColor,
|
),
|
||||||
boxShadow: const [
|
const VSpace(20),
|
||||||
BoxShadow(
|
],
|
||||||
color: Color(0x141F2225),
|
);
|
||||||
blurRadius: 8,
|
}
|
||||||
offset: Offset(0, 2),
|
|
||||||
),
|
@override
|
||||||
],
|
void dispose() {
|
||||||
borderRadius: BorderRadius.circular(8),
|
tabController.dispose();
|
||||||
),
|
super.dispose();
|
||||||
onValueChanged: (v) {
|
}
|
||||||
setState(() {
|
|
||||||
selectedTab = v;
|
Widget _buildTabBar(BuildContext context) {
|
||||||
});
|
final children = [
|
||||||
},
|
for (final tab in ShareMenuTab.supportedTabs)
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 10),
|
||||||
|
child: _Segment(
|
||||||
|
title: tab.i18n.tr(),
|
||||||
|
isSelected: selectedTab == tab,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
_buildTab(context),
|
];
|
||||||
],
|
return TabBar(
|
||||||
|
indicatorSize: TabBarIndicatorSize.label,
|
||||||
|
indicator: RoundUnderlineTabIndicator(
|
||||||
|
width: 48.0,
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: Theme.of(context).colorScheme.primary,
|
||||||
|
width: 3,
|
||||||
|
),
|
||||||
|
insets: const EdgeInsets.only(bottom: -2),
|
||||||
|
),
|
||||||
|
isScrollable: true,
|
||||||
|
controller: tabController,
|
||||||
|
tabs: children,
|
||||||
|
onTap: (index) {
|
||||||
|
setState(() {
|
||||||
|
selectedTab = ShareMenuTab.supportedTabs[index];
|
||||||
|
});
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flowy_infra/size.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'package:flowy_infra/size.dart';
|
|
||||||
|
|
||||||
class FlowyTextField extends StatefulWidget {
|
class FlowyTextField extends StatefulWidget {
|
||||||
final String? hintText;
|
final String? hintText;
|
||||||
final String? text;
|
final String? text;
|
||||||
@ -37,6 +36,7 @@ class FlowyTextField extends StatefulWidget {
|
|||||||
final List<TextInputFormatter>? inputFormatters;
|
final List<TextInputFormatter>? inputFormatters;
|
||||||
final bool obscureText;
|
final bool obscureText;
|
||||||
final bool isDense;
|
final bool isDense;
|
||||||
|
final bool readOnly;
|
||||||
|
|
||||||
const FlowyTextField({
|
const FlowyTextField({
|
||||||
super.key,
|
super.key,
|
||||||
@ -71,6 +71,7 @@ class FlowyTextField extends StatefulWidget {
|
|||||||
this.inputFormatters,
|
this.inputFormatters,
|
||||||
this.obscureText = false,
|
this.obscureText = false,
|
||||||
this.isDense = true,
|
this.isDense = true,
|
||||||
|
this.readOnly = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -144,6 +145,7 @@ class FlowyTextFieldState extends State<FlowyTextField> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return TextField(
|
return TextField(
|
||||||
|
readOnly: widget.readOnly,
|
||||||
controller: controller,
|
controller: controller,
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
onChanged: (text) {
|
onChanged: (text) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user