Skip to content

Instantly share code, notes, and snippets.

@knaeckeKami
Created February 14, 2024 15:39
Show Gist options
  • Save knaeckeKami/b13feae29a3946287e10bf26d489a891 to your computer and use it in GitHub Desktop.
Save knaeckeKami/b13feae29a3946287e10bf26d489a891 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
const Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(
scaffoldBackgroundColor: darkBlue,
),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends HookWidget {
@override
Widget build(BuildContext context) {
final reverse = useState(false);
return Column(
children: [
Row(
textDirection: reverse.value ? TextDirection.rtl : TextDirection.ltr,
children: [
Expanded(
child: TextField(
decoration: InputDecoration(labelText: "label 1"),
)),
Expanded(
child: TextField(
decoration: InputDecoration(labelText: "label 2"),
)),
],
),
TextField(
decoration: InputDecoration(labelText: "label 3"),
),
SwitchListTile(
title: Text("reverse"),
value: reverse.value,
onChanged: (value) {
reverse.value = value;
}),
],
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment