Const isPro = bool. FromEnvironment (‘dart.vm.product’); // Whether to release mode
2. Change the button height. The default height is 36. Use ButtonTheme to change the height. The MaterailApp theme can be changed globally:
return MaterialApp(
debugShowCheckedModeBanner: false,
title: "news module",
theme: ThemeData(
buttonTheme: ButtonThemeData(
height: 30
),
),
home: NewsBaseSharedDataWidget(),
);
Copy the code
You can also change a button height individually. Wrap the ButtonTheme around the button and set height.
ButtonTheme(
height: 30,
child: RaisedButton(
child: Text('RaisedButton',),
color: Colors.blue,
onPressed: (){
},
);
Copy the code
3. Set the flutter Widget not to change with system font changes and the textScaleFactor coefficient to 1.
MediaQuery(
data: MediaQueryData.fromWindow(WidgetsBinding.instance.window)
.copyWith(textScaleFactor: 1),
Copy the code
4. Long press pop to copy, paste, and other Chinese display problems of flutter
Dart does not take into account the actual text height resulting in Chinese (copy and paste, etc.). This bug is found in the flutter source, flutter lib SRC cupertino text_selection Dart _kToolbarHeight = 43.0 to 45.0. If you have a better solution, please let me know
5. How to implement 1px in Flutter
var px = 1 / window.devicePixelRatio;
var px1 = 1 / (MediaQuery.of(context).devicePixelRatio);
Copy the code
Android Studio shortcut
1. View the previous CMD + E file
2. Quickly view the class definition option + space
3 Switch the upper and lower files TAB CTRL + TAB
CMD +shifit+ Enter
5. The difference between Enter and TAB after code completion
6. Option + Enter Adds an external widget to a widget.
7. Stless automatic StatelessWidget inheritance.
8. Stful statefulWidget automatically
9. Option + Up Select a block
CMD +option+L
11. Shift +F6 rename methods, widgets
12. CTRL +option+O delete unused imports
13. Select the code for a widget CMD + W
14. Flutter Outline module, move widgets, extract widgets into methods, widgets
15. Search for the current file contents CMD +f. Global search CMD + Shift + F replacement is R
16. Locate the line CMD +L
17. Quickly select a line CMD + Shift + left and right arrows. Quickly go to the start and end of a line, CMD + left and right arrows
18. Return to the previous editing location CMD +option+ left and right arrows
19. CMD + “+/-” closes and opens a block.
Shift + F6. Change your name
21. Return to CMD + Shift +del where you left off
22. CMD +p is displayed
23. View a class definition: Alt +space
24. Press Alt +F to view the file
25. Modify the selection range. Alt + up and down arrows
26. Switch files by Alt + TAB
27. Complete statements. Cmd +shift +enter
28. Copy line CMD +d
29. Merge text merge lines. Ctrl + shift +j
30. Dynamic code templates CMD + J
31. Move rows up and down. Alt + Shift + Up, down
32. Edit breakpoints. Ctrl + click breakpoint