Posts

Showing posts with the label Flutter

Stop using third party packages that has many dependencies that the author didn't have a check before they use

33. "remove every backend project that uses node third party packages, they might has backdoor that could use your VPS as their VPS to act like a general web client for hackers"   it is even worse if you use npm in root VPS, because the npm will always use new version of a package or sub_package, how can you make sure your 3000 dependencies will not have a virus that could use your VPS root permission to do bad things?   it is the same for other package manager, for example, python pip. or golang package, java package, rust package, flutter package. in chinese, people usally call those machine that has those software running 'rou ji'. """ 利用 package manager 自动更新新版本的特性,做远控 轻而易举 就算不更新,利用现有的package,二进制文件或者脚本 一个post发到黑客服务器,它就知道你的电脑能不能被控制 对于root设备,被控制就是被完全控制,对于普通设备,就是被当成hacker web 客户端,可以被拿来在网上发垃圾信息、垃圾账号注册 到时候你的ip就会被当成坏ip被服务器墙掉 """

Some tips about flutter SingleChildScrollView()

1. It should be used under a fixed height or width container.  2. Most of the time, it should be: Row( children: [ Expanded( child: SingleChildScrollView(...) ), FixedSizeIcon(), FixedSizeIcon(), ] ) 3. In some special case, it should be this: Row( children: [ Flexable( flex: 3 , child: SingleChildScrollView(...) ), Flexable( flex: 1 , child: Row( children:[ FixedSizeIcon(), FixedSizeIcon(), ] ) ), ] ) ​

How to make characters in Flutter to have the same width

https://stackoverflow.com/questions/54935487/is-it-possible-to-make-characters-in-flutter-to-have-the-same-width

What I have learned from the frontend development

1. Always add a loading indicator for any actions that consume your user's waiting time. 2. Always add a confirm window for an action that may risk users to make

GetX key points after one-month of coding

GetxController OK, so at the first, you need to know that every core functions for your data have to be inside of a class. They call that class a controller . It may look like this: class MyMoneyDataController extends GetxController { } Rx** Then you need to have some variables to work with. You put all of your variables into the Controller class you have. For example: class MyMoneyDataController extends GetxController { RxMap< String , String > yourMap = RxMap< String , String >(); } No matter what data type you have, you shall always wrap it with Rx** . Rx here means Observable x variable . (I know it sounds ridiculous and they are not relevant, but that’s how they define it) For example, list When you create one, you use: RxList yourList = RxList([]); // RxList yourList = ["default value"].obs; // I don't like this way, because it can't have an empty list. When you use one, you use: yourList.toList(); Trust me, if you do...

How to use Golang to make a flutter plugin

1. compile golang codes into a aar file https://yingshaoxo.gitbook.io/go-tutorial-for-pythoner/go-for-android 2. create a flutter plugin https://flutter.dev/docs/development/packages-and-plugins/developing-packages#step-1-create-the-package-1 3. use the aar file https://stackoverflow.com/a/57075972/8667243 Congratulations  You have a common code base for windows, android, IOS now. More info: https://github.com/yingshaoxo/flutter-discoverpingableserviceonlocalnetwork ​

Tips for using flutter provider and setState

 # A ```dart final appModel = Provider.of<AppModel>(context, listen: true); ``` Whenever you change variables under `appModel`, `didChangeDependencies()` will be called again. If you modify `appModel` under the function `didChangeDependencies()`, you will create a dead loop, it re-renders your component(or widget) over and over again. # B ```dart setState(() { }); ``` `setState` also forces the flutter to re-render your widget, but it does it by calling the `build(BuildContext context)` function again. So the `didChangeDependencies()` function won't be called. So no dead loop would be created. It's safer. # A + B Normally, you want to just use B, but B has drawbacks: you can't pass data to your children widgets. What can we do then? We use them together! But just remember, change your `appModel` variable only when the value got changes. For example, you can do a check like this: ```dart String get current_page {     return this._current_page; } set current_page...

Flutter and Pigeon tutorial

install https://pub.dev/packages/pigeon#flutter-calling-into-android-steps write import 'package:pigeon/pigeon_lib.dart' ; class SearchRequest { String keyword; } class SearchReply { String result; } //@HostApi(dartHostTestHandler: 'TestHostVideoPlayerApi') @HostApi () abstract class FileManagerApi { SearchReply search(SearchRequest request); } void configurePigeon(PigeonOptions opts) { opts.dartOut = 'lib/messages.dart' ; opts.objcHeaderOut = 'ios/Runner/messages.h' ; opts.objcSourceOut = 'ios/Runner/messages.m' ; opts.objcOptions.prefix = 'FLT' ; opts.javaOut = 'android/app/src/main/java/io/flutter/plugins/filemanager/Messages.java' ; opts.javaOptions.package = 'io.flutter.plugins.filemanager' ; } compile flutter pub run pigeon --input pigeons/messages.dart java side import androidx.annotation.NonNull; import io.flutter.embedding.android.FlutterActivity; import io...

How to use Flutter and Python to create a Linux Snap Desktop App

https://youtu.be/fBSHvm47sm4

Flutter is a good front-end framework

It is kind of like Reactjs. I mean, the widget == component . And if you want to refresh your page, you need to use setState(() {}) didChangeDependencies == componentDidMount As for the programming language it based: dart. I think it as a mix of CPP, java, python, javascript, typescript, CSS. cpp: The constructor has to have the same name as the class name it belongs to. You can use void as a return value. java: You can override an existing function inside a class; Every widget or component is a class. python: how you import a package; you use super to refer to the parent class; async and await ; _ indicates private function. javascript: then , var , forEach , map , where(filter) , contains , ()=>{} typescript: how you specify types in typescript, how you do it with dart. css: actually all style properties are related to CSS styling. ​