Comments (10)
Okay, I will do that.
from smooth-app.
@monsieurtanuki Okay. I will do it that way. How should I handle the case when the axis is horizontal in the _buildActions()
function?
from smooth-app.
Hey! Can I work on this issue?
from smooth-app.
Hey! Can I work on this issue?
@Smit56R Sure!
Basically the idea is to have a dialog (screenshot 1) that somehow looks like screenshot 2.
Easy step 1: a dialog with 3 vertical buttons with the same labels and actions as screenshot 2.
Please send a screenshot before actually sending a PR.
from smooth-app.
I'm not sure this is a nice idea to merge things, as here, yes, they do the same thing, but that's not the expected behavior.
The one on the carousel is a returning message VS a one-time message for the one in the login.
from smooth-app.
@g123k I sort of agree with you, the "merge" wording is not correct, the goal is not a unique widget used in both cases.
My point was to use the same labels and the same 3 possible choices - which is not the case currently.
That's why I suggested a dialog with 3 vertical buttons for a quick fix.
Do we agree on that, or do you consider that the "ask me later" choice is not relevant when logging in?
from smooth-app.
@g123k @monsieurtanuki While you decide, I have altered the SmoothAlertDialog
to have a parameter for delayAction
which renders the dialogue in the proposed UI, if provided as an argument. It switches to a three-row layout or two-row layout according to the screen size.
Here is the code snippet for SmoothAlertDialog
:
class SmoothAlertDialog extends StatelessWidget {
const SmoothAlertDialog({
this.title,
required this.body,
this.positiveAction,
this.negativeAction,
this.delayAction,
this.actionsAxis,
this.actionsOrder,
this.close = false,
this.margin,
this.contentPadding,
}) : assert(
body is! LayoutBuilder,
"LayoutBuilder isn't supported with Dialogs",
),
assert(
delayAction == null ||
(positiveAction != null || negativeAction != null),
"Delay action isn't supported without positive action and negative action",
);
final String? title;
final bool close;
final Widget body;
final SmoothActionButton? positiveAction;
final SmoothActionButton? negativeAction;
final SmoothActionButton? delayAction;
final Axis? actionsAxis;
final SmoothButtonsBarOrder? actionsOrder;
final EdgeInsets? margin;
final EdgeInsetsDirectional? contentPadding;
/// Default value [_defaultInsetPadding] in dialog.dart
static const EdgeInsets defaultMargin = EdgeInsets.symmetric(
horizontal: 40.0,
vertical: 24.0,
);
static const EdgeInsetsDirectional _smallContentPadding =
EdgeInsetsDirectional.only(
start: SMALL_SPACE,
top: MEDIUM_SPACE,
end: SMALL_SPACE,
bottom: SMALL_SPACE,
);
static const EdgeInsetsDirectional _contentPadding =
EdgeInsetsDirectional.only(
start: 22.0,
top: VERY_LARGE_SPACE,
end: 22.0,
bottom: 22.0,
);
@override
Widget build(BuildContext context) {
final Widget content = _buildContent(context);
final EdgeInsetsDirectional padding =
contentPadding ?? defaultContentPadding(context);
return AlertDialog(
scrollable: false,
elevation: 4.0,
insetPadding: margin ?? defaultMargin,
contentPadding: EdgeInsets.zero,
shape: const RoundedRectangleBorder(borderRadius: ROUNDED_BORDER_RADIUS),
content: ClipRRect(
borderRadius: ROUNDED_BORDER_RADIUS,
child: Scrollbar(
child: SingleChildScrollView(
child: Padding(
padding: padding,
child: Column(
children: <Widget>[
content,
if (hasActions) _buildBottomBar(padding),
],
),
),
),
),
),
);
}
Padding _buildBottomBar(EdgeInsetsDirectional padding) {
final bool singleButton = (positiveAction != null &&
negativeAction == null &&
delayAction == null) ||
(negativeAction != null &&
positiveAction == null &&
delayAction == null) ||
(delayAction != null &&
positiveAction == null &&
negativeAction == null);
return Padding(
padding: EdgeInsetsDirectional.only(
top: padding.bottom,
start: (actionsAxis == Axis.horizontal || singleButton)
? SMALL_SPACE
: 0.0,
end: positiveAction != null &&
negativeAction != null &&
delayAction != null
? 0.0
: SMALL_SPACE,
),
child: SmoothActionButtonsBar(
positiveAction: positiveAction,
negativeAction: negativeAction,
delayAction: delayAction,
axis: actionsAxis,
order: actionsOrder,
),
);
}
bool get hasActions =>
positiveAction != null || negativeAction != null || delayAction != null;
Widget _buildContent(final BuildContext context) => DefaultTextStyle.merge(
style: const TextStyle(height: 1.5),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
if (title != null) _SmoothDialogTitle(label: title!, close: close),
body,
],
),
);
static EdgeInsetsDirectional defaultContentPadding(BuildContext context) {
return (context.isSmallDevice() ? _smallContentPadding : _contentPadding);
}
}
Is this how you want it to work?
from smooth-app.
@Smit56R Please just add a neutralAction
and display them according to the axis (vertically in this case), which will look like your first screenshot. This way the issue will be solved, the simpler the better.
from smooth-app.
Related Issues (20)
- Send-us an email should be the first item in the Contact screen HOT 1
- In the search bar, if we enter a barcode with spaces, no product will be found HOT 3
- Add a QRCode icon in the font
- Add a Matomo event when the app scans a product that is marked "obsolete" HOT 2
- Use automatic language recognition to suggest additional languages to add, or suggest correcting product language before sending
- Explore segmentation of photos on device
- Bring minimum on-device moderation using MLKit HOT 3
- Explore using the on-device LLM for various tasks HOT 1
- Create a custom Tensorflow model for MLKit to classify Nutrition facts, Packaging instruction, Front and Ingredients photo on device
- Add a hidden option to authenticate scan queries HOT 4
- Show ingredients photo editing in the Ingredients extraction screen
- Forever loop when connecting for the first time HOT 3
- Lousy crop parameters from the server HOT 2
- Black screen when going back from home HOT 2
- Autocomplete: new Elastic Search or old tag type?
- Refactoring of the OCR page UI/UX HOT 9
- Add the privacy policy page
- The moderator knowledge panels are not shown to my authentified account HOT 5
- Open Prices (tracker) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from smooth-app.