Mobile Tech
1.14K subscribers
91 photos
8 videos
6 files
138 links
Michael Lazebny's blog about @dart and @flutter
lazebny.io
Download Telegram
What do you think about such outlines?

Looks good to me and provides short overview of a section.
👍9👎3
Some of my plans for June:

- land a few updates to Sizzle starter (improved http client, tests, structure and docs)
- write RTE (rich text editor) specification (I’m planning to build editor some time I have clear understanding of all the details)
- article about Focus in flutter (tab traversal, shortcuts, screen reader, how does it work under the hood)
🔥12
Implemented this chart using CustomPainter in Flutter.

25👍 and I will publish the source code :)
👍55🤡3🔥1
I’m researching the internals of EditableText (widget that is used by TextField)

Planning to write an article about how it renders text, manages selection and communicates with platform

Sounds interesting? Press 👍
Please open Telegram to view this post
VIEW IN TELEGRAM
👍57
New article is coming on Monday. It is about Focus System - Focus Tree, Traversal and Key Events!
🔥9👍32
Mobile Tech
Next article topic
Next article is going to be about implementing UI Kit!

Things to be covered:
- Theme, fonts
- Creating components (buttons, text, dialogs, sheets)
- Dedicated package for ui kit
- Optionally creating preview for UI elements and theme

Press 👍 if you're waiting for it.
Please open Telegram to view this post
VIEW IN TELEGRAM
👍373🔥2
This media is not supported in your browser
VIEW IN TELEGRAM
🔥 UIKit in-progress

Will be incredibly useful article.
Please open Telegram to view this post
VIEW IN TELEGRAM
1🔥22🥰2
Tomorrow, I'm launching a new article series on creating UI Kits.

I’ll guide you through developing various components like buttons, text fields, and more.

You’ll also learn about animations, transitions, iconography, responsive design tools, and best practices for layouts and custom components.

#article #uikit #flutter
722👍7🔥7
Creating the Perfect UI Kit in Flutter, Part One! Theme, typography, buttons, text fields and more in this comprehensive article:

https://lazebny.io/creating-ui-kit-in-flutter-1
519🔥3👍2
#tip

If you're using SharedPreferences (or any other key-value storage) consider creating a separate class that manages the entry.

This way, you ensure that the key is the same during setting and reading as well as simply convenient and powerful as you may create custom codecs and support complex types.

See source code here
19🔥7💯4
How to implement design breakpoints correctly:

Define a class that contains breakpoints for your app, usually it contains 2-3 values:


enum WindowSize {
compact._(0, 600),
medium._(600, 839),
expanded._(840, 1199),
large._(1200, 1599),
extraLarge._(1600, double.infinity);

/// The minimum width of the breakpoint.
final double min;

/// The maximum width of the breakpoint.
final double max;

const WindowSize._(this.min, this.max);
}


Define a scope that provides this WindowSize down the context:


/// Scope that provides [WindowSize] to its descendants.
class WindowSizeScope extends StatefulWidget {
/// Creates a [WindowSizeScope] that provides [WindowSize] to its descendants.
const WindowSizeScope({
required this.child,
super.key,
});

/// The widget below this widget in the tree.
final Widget child;

/// Returns the [WindowSize] of the nearest [WindowSizeScope] ancestor.
static WindowSize of(BuildContext context, {bool listen = true}) {
final inherited = listen
? context.dependOnInheritedWidgetOfExactType<_InheritedWindowSize>()
: context.findAncestorWidgetOfExactType<_InheritedWindowSize>();

return inherited?.windowSize ??
(throw FlutterError('WindowSizeScope was not found in the widget tree'));
}

@override
State<WindowSizeScope> createState() => _WindowSizeScopeState();
}

class _WindowSizeScopeState extends State<WindowSizeScope> with WidgetsBindingObserver {
late WindowSize _windowSize;

Size _getScreenSize() {
final view = PlatformDispatcher.instance.views.first;
return view.physicalSize / view.devicePixelRatio;
}

@override
void initState() {
_windowSize = WindowSize.fromWidth(_getScreenSize().width);
WidgetsBinding.instance.addObserver(this);
super.initState();
}

@override
void didChangeMetrics() {
final windowSize = WindowSize.fromWidth(_getScreenSize().width);

if (_windowSize != windowSize) {
setState(() => _windowSize = windowSize);
}
super.didChangeMetrics();
}

@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}

@override
Widget build(BuildContext context) => _InheritedWindowSize(
windowSize: _windowSize,
child: widget.child,
);
}


Then get this value from the BuildContext and do whatever you want:


final windowSize = WindowSize.of(context);

if (windowSize.isExpanded) return ExpandedWidget();

if (windowSize.isMedium) return MediumWidget();


Here are the sources
7🔥13❤‍🔥5👍4👏1