Skip to content

Instantly share code, notes, and snippets.

@Staars
Created July 13, 2023 13:10
Show Gist options
  • Save Staars/e58ab2d026192cb18ff7191fb3e3803e to your computer and use it in GitHub Desktop.
Save Staars/e58ab2d026192cb18ff7191fb3e3803e to your computer and use it in GitHub Desktop.
Flutter test
// Copyright 2020, the Flutter project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
import 'package:intl/intl.dart' as intl;
class deviceInfo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ExpansionPanelList(
expansionCallback: (int index, bool isExpanded) {
},
children: [
ExpansionPanel(
headerBuilder:
(context, isOpen) {
return Text("Info");
},
body: Column(
children: [
Text("Firmware"),
Text("Version"),
Text("Chip"),
Text("Device name"),
],
),
isExpanded: true,
canTapOnHeader: true,
),
],
);
}
}
class FormWidgetsDemo extends StatefulWidget {
const FormWidgetsDemo({super.key});
@override
State<FormWidgetsDemo> createState() => _FormWidgetsDemoState();
}
class _FormWidgetsDemoState extends State<FormWidgetsDemo> {
final _formKey = GlobalKey<FormState>();
String title = '';
String description = '';
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Commision device'),
),
body: Form(
key: _formKey,
child: Scrollbar(
child: Align(
alignment: Alignment.topCenter,
child: Card(
child: SingleChildScrollView(
padding: const EdgeInsets.all(16),
child: ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 400),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
...[
TextFormField(
decoration: const InputDecoration(
filled: true,
hintText: 'Enter SSID...',
labelText: 'SSID',
),
onChanged: (value) {
setState(() {
title = value;
});
},
),
TextFormField(
decoration: const InputDecoration(
filled: true,
hintText: 'Enter Password...',
labelText: 'Password',
),
onChanged: (value) {
setState(() {
title = value;
});
},
),
Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'Device Info',
style: Theme.of(context).textTheme.bodyLarge,
),
TextButton(
child: const Text('GET'),
onPressed: () async {}
),
],
),
deviceInfo()
],
),
].expand(
(widget) => [
widget,
const SizedBox(
height: 24,
)
],
)
],
),
),
),
),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment