Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import 'package:flutter/cupertino.dart';
- import 'package:flutter_switch/flutter_switch.dart';
- import 'package:smart_relay/theme.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_alarm_clock/flutter_alarm_clock.dart';
- class HomePage extends StatefulWidget {
- @override
- State<HomePage> createState() => _HomePageState();
- }
- class _HomePageState extends State<HomePage> {
- bool status = false;
- @override
- Widget build(BuildContext context) {
- Widget header() {
- return Container(
- margin: EdgeInsets.only(
- top: defaultMargin,
- left: defaultMargin,
- right: defaultMargin,
- ),
- decoration: BoxDecoration(
- border: Border.all(
- color: Color(0xfffa4205),
- ),
- borderRadius: BorderRadius.all(Radius.circular(20)),
- ),
- child: Row(
- children: [
- Expanded(
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- 'Smart Relay',
- style: primaryTextStyle.copyWith(
- fontSize: 24,
- fontWeight: semiBold,
- ),
- ),
- Text(
- '@sebuahhobi',
- style: primaryTextStyle.copyWith(
- fontSize: 16,
- ),
- )
- ],
- ),
- ),
- Container(
- width: 54,
- height: 54,
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- image: DecorationImage(
- image: AssetImage('assets/sebuahhobi.png'),
- ),
- ),
- )
- ],
- ),
- );
- }
- Widget header2() {
- return Container(
- width: 200,
- height: 250,
- decoration: const BoxDecoration(
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(0),
- topRight: Radius.circular(0),
- bottomLeft: Radius.circular(40),
- bottomRight: Radius.circular(40),
- ),
- color: Color(0xff39e0fa),
- ),
- child: Row(
- children: [
- Image.asset(
- 'assets/smart_relay.png',
- width: 200,
- height: 125,
- fit: BoxFit.contain,
- ),
- Text(
- 'COurt VISON',
- style: blackTextStyle.copyWith(
- fontSize: 18,
- fontWeight: semiBold,
- ),
- overflow: TextOverflow.ellipsis,
- ),
- ],
- ),
- );
- }
- Widget switchs(nama, id) {
- return Row(
- children: <Widget>[
- Text(
- nama,
- style: primaryTextStyle.copyWith(
- fontSize: 24,
- fontWeight: semiBold,
- ),
- ),
- const SizedBox(
- width: 20,
- ),
- FlutterSwitch(
- width: 125.0,
- height: 55.0,
- valueFontSize: 25.0,
- toggleSize: 45.0,
- value: status,
- borderRadius: 30.0,
- padding: 8.0,
- showOnOff: true,
- onToggle: (val) {
- setState(() {
- status = val;
- });
- },
- ),
- ],
- );
- }
- Widget switch_generator() {
- return Container(
- child: Row(
- children: [
- Column(
- children: [
- Row(
- children: [
- Column(
- children: [
- switchs("Relay 1", 1),
- const SizedBox(
- height: 20,
- ),
- switchs("Relay 2", 1),
- switchs("Relay 1", 1),
- switchs("Relay 2", 1),
- ],
- ),
- ],
- ),
- ],
- ),
- ],
- ),
- );
- }
- return ListView(children: [
- header2(),
- switch_generator(),
- ]);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement