dflutter_lint_rules 2.0.2 dflutter_lint_rules: ^2.0.2 copied to clipboard
Lint rules for "Dizoft Team" company for Dart and Flutter projects.
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({
required this.title,
super.key,
});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'You have pushed the button this many times:',
),
Text(
'$_counter',
style: Theme.of(context).textTheme.headlineMedium,
),
const TestWidget(
text: 'Dsd',
child: Text('s'),
),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
),
);
}
}
class NewTest extends StatefulWidget {
const NewTest({super.key});
@override
State<NewTest> createState() => _NewTestState();
}
class _NewTestState extends State<NewTest> {
late final String _bla;
@override
Widget build(BuildContext context) {
debugPrint(_bla);
return const Placeholder();
}
}
class TestWidget extends StatelessWidget {
const TestWidget({
required this.text,
required this.child,
super.key,
});
final String text;
final Widget child;
@override
Widget build(BuildContext context) {
return Text(text);
}
}