1. iOS Swift - Grand Central Dispatch (2)

    1. Dispatch Groups

    • With Dispatch Groups, you can group together multiple tasks
    • You can either wait for them to complete or receive a notification once they finish
    • Tasks can be asynchronous or synchronous and can even run on different queues.

    2. Using dispatch groups with synchronous wait() method

    // 1
    DispatchQueue …
    read more

    There are comments.

  2. iOS Swift - Grand Central Dispatch (1)

    1. What is Task ?

    • Is code block
    • Operates based on FIFO principle

    2. Queue

    • Queue includes many Tasks
    • Task can be executed sequentially (Serial Queue) or concurrently (Concurrent Queue)

    3. DispatchQueue

    #### 3.1 Main Queue - For update user interface

    DispatchQueue.main.async() {
       //Code Run On Main Thread
    }
    

    #### 3.2 Global …

    read more

    There are comments.

  3. [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.

  4. [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.

  5. 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.

  6. 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.

  7. 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.

  8. Flutter Enum

    What is enum ?

    • Enum in dart is enumerated, iterable
    • Enum is used for defining named constant values.

    How to use ?

    • Synstax
    enum PlatformEnum {
        android, ios, windown
    }
    
    • Iterate over enum values
    PlatformEnum.values.forEach((value) => print('value: $value, index: ${value.index}'));
    
    • Extension enum
    extension PlatformEnumExtension on PlatformEnum {
        String? get title {
            switch …
    read more

    There are comments.

  9. Flutter Buttons

    ElevatedButton

    ElevatedButton(
      onPressed: () {},
      child: Text('Button'),
      style: ElevatedButton.styleFrom(shape: StadiumBorder()),
    )
    
    shape types: RoundedRectangleBorder / StadiumBorder / CircleBorder / BeveledRectangleBorder
    

    OutlinedButton

    OutlinedButton(
        onPressed: () {},
        child: Text('Button'),
        style: OutlinedButton.styleFrom(
            shape: StadiumBorder(),
        ),
    )
    

    TextButton:

    • You can always use TextButton if you don't want an outline or color fill.
    • Don't forget, there's also an .icon constructor …
    read more

    There are comments.

  10. Disable indexing Xcode

    Stopping xcode from indexing Just run this command in the terminal to turn off Indexing:

    defaults write com.apple.dt.XCode IDEIndexDisable 1
    

    To turn it back on, run this:

    defaults write com.apple.dt.XCode IDEIndexDisable 0
    
    read more

    There are comments.

« Page 2 / 3 »

Links

Social