插件 Flutter Snippets
Flutter Snippets
Live Templates
选择Dart 语言 然后添加
pkey 构造函数
const 类名({Key? key}) : super(key: key);
plesswidget
import 'package:flutter/material.dart';
import 'dart:math';
class TestLessWidget extends StatelessWidget {
const TestLessWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: const Text("测试"),
),
body: Container(
color: Color.fromRGBO(Random().nextInt(256), Random().nextInt(256), Random().nextInt(256), 1),
),
);
}
}
pfulwidget
import 'package:flutter/material.dart';
import 'dart:math';
class TestFulWidget extends StatefulWidget {
const TestFulWidget({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => TestFulState();
}
class TestFulState extends State<TestFulWidget> {
@override
Widget build(BuildContext context) {
// TODO: implement build
return Scaffold(
appBar: AppBar(
title: const Text("测试"),
),
body: Container(
color: Color.fromRGBO(Random().nextInt(256), Random().nextInt(256), Random().nextInt(256), 1),
),
);
}
}
pranomcolor
Color.fromRGBO(Random().nextInt(256), Random().nextInt(256), Random().nextInt(256), 1)
papp
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:learn/_00_Utils/log.dart';
main () {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "你好",
home: Scaffold(
appBar: AppBar(title: const Text("测试用例"),),
body: Container(color: Color.fromRGBO(Random().nextInt(256), Random().nextInt(256), Random().nextInt(256), 1),),
),
theme: ThemeData(
primarySwatch: Colors.blue,
),
debugShowCheckedModeBanner: false,
);
}
}