Other articles


  1. [Flutter] Easy use enum in flutter version 3

    enum HogeType {
      hoge('ใปใ’', 'hoge'),
      fuga('ใตใŒ', 'fuga'),
      piyo('ใดใ‚ˆ', 'piyo'),
      foo('ใตใƒผ', 'foo'),
      bar('ใฐใƒผ', 'bar'),
      none('', '');
    
      const HogeType(this.name, this.type);
      final String name;
      final String type;
    
      static HogeType fromType(String from) {
        return HogeType.values.firstWhere(
          (value) {
            return value.type == from;
          },
          orElse โ€ฆ
    read more

    There are comments.

  2. [Flutter] How to sleep ?

    Sleep with Flutter

    It's a small story.

    It's a memorandum because I google it every time ๐Ÿ˜…

    How to pause or delay processing in Flutter? (Like sleep in PHP)

    • Pause processing by specifying the number of seconds
    import 'dart:io';
    
    sleep(Duration(seconds: 1));
    
    • Run an empty asynchronous process specifying the โ€ฆ
    read more

    There are comments.

  3. [Flutter] Gradient Text Widget

    Gradient Text widget

    import 'package:flutter/material.dart';
    
    class GradientText extends StatelessWidget {
      const GradientText(
        this.text, {
        required this.gradient,
        this.style,
      });
    
      final String text;
      final TextStyle? style;
      final Gradient gradient;
    
      @override
      Widget build(BuildContext context) {
        return ShaderMask(
          blendMode: BlendMode.srcIn,
          shaderCallback: (bounds) => gradient.createShader(
            Rect.fromLTWH(0, 0, bounds.width โ€ฆ
    read more

    There are comments.

  4. Implementation Universal/AppLink in both iOS and Android

    Android

    1. Host a website with https then upload config files: https://your-web-host-name/.well-known/assetlinks.json
    [
      {
        "relation": ["delegate_permission/common.handle_all_urls"],
        "target": {
          "namespace": "android_app",
          "package_name": "<android-app-package-name>",
          "sha256_cert_fingerprints": ["<android-fingerprint>"]
        }
      }
    ]
    

    get android-debug-fingerprint from

    keytool -exportcert -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore

    1. Add code to android/app/src/main/AndroidManifest.xml
    <activity ...>
      ...
      <intent-filter โ€ฆ
    read more

    There are comments.

  5. [Flutter] Widget to image

    final GlobalKey genKey = GlobalKey();
    
    RepaintBoundary(
        key: genKey,
        child: ListTile(
            leading: CircleAvatar(),
            title: Text("www.ayavn.us"),
        ),
    ),
    
    
    ### Save image
    
    import 'package:path_provider/path_provider.dart';
    
    Future<void> takePicture() async {
      RenderRepaintBoundary boundary = genKey.currentContext.findRenderObject();
      ui.Image image = await boundary.toImage();
      final directory = (await getApplicationDocumentsDirectory()).path;
      ByteData byteData = await image.toByteData(format: ui โ€ฆ
    read more

    There are comments.

  6. [Flutter] Ripple animation

    It is called Ripple Animation and the key to do it is using scaleTranstion

    class RipplesAnimation extends StatefulWidget {
      const RipplesAnimation({Key key, this.size = 80.0, this.color = Colors.red,
        this.onPressed, @required this.child,}) : super(key: key);
      final double size;
      final Color color;
      final Widget child;
      final VoidCallback onPressed โ€ฆ
    read more

    There are comments.

  7. Flutter online tools

    Image:

    1. Remove style tag for SVG image
       โ•โ•โ•โ•โ•โ•โ•โ• Exception caught by SVG โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
    The following UnimplementedError was thrown in parseSvgElement:
    The <style> element is not implemented in this library.
    
    Style elements are not supported by this library and the requested SVG may not render as intended.
    
    If possible, ensure the SVG uses โ€ฆ
    read more

    There are comments.

  8. Flutter InAppWebview load css from assets

    Plugin: InAppWebview

    • Register css relation path to pubspect.yaml file.
    • Example: assets/css
    • File: custom.css
    body {
        color: red;
    }
    
    InAppWebView(
        initialUrlRequest:
            URLRequest(url: Uri.parse('https://${your_url}')),
        initialOptions: InAppWebViewGroupOptions(
            crossPlatform: InAppWebViewOptions(),
            android: AndroidInAppWebViewOptions(
            useHybridComposition: true,
            ),
            ios: IOSInAppWebViewOptions(
            allowsInlineMediaPlayback: true,
            ),
        ),
        onWebViewCreated: (InAppWebViewController controller) {
    
        },
        onLoadStart: (controller, url) {
            controller
                    ..injectCSSFileFromAsset(
                        assetFilePath: 'assets/css โ€ฆ
    read more

    There are comments.

  9. Flutter InAppWebview with basic authenication

    Plugin: InAppWebview

    InAppWebView(
        initialUrlRequest:
            URLRequest(url: Uri.parse('https://${your_url}')),
        initialOptions: InAppWebViewGroupOptions(
            crossPlatform: InAppWebViewOptions(),
            android: AndroidInAppWebViewOptions(
            useHybridComposition: true,
            ),
            ios: IOSInAppWebViewOptions(
            allowsInlineMediaPlayback: true,
            ),
        ),
        onWebViewCreated: (InAppWebViewController controller) {
    
        },
        onLoadStart: (controller, url) {
    
        },
        onLoadStop: (controller, url) async {
    
        },
        onProgressChanged:
            (InAppWebViewController controller, int progress) {
        },
        onReceivedHttpAuthRequest: (controller, challenge) async {
            // BASIC AUTHENICATION ACCOUNT
            return HttpAuthResponse(
                username: "username",
                password: "password โ€ฆ
    read more

    There are comments.

Page 1 / 2 »

Links

Social