Skip to content

Commit

Permalink
update UI for Bluetooth Set QR Page
Browse files Browse the repository at this point in the history
  • Loading branch information
belanasaikiran committed Jul 5, 2024
1 parent 5b0e3a5 commit eaa03c0
Show file tree
Hide file tree
Showing 3 changed files with 234 additions and 12 deletions.
44 changes: 44 additions & 0 deletions harmonylink/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
197 changes: 188 additions & 9 deletions harmonylink/lib/pages/Setup/SetBluetooth.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: prefer_const_constructors
// ignore_for_file: prefer_const_constructors, unnecessary_const

import 'package:flutter/material.dart';

Expand All @@ -12,16 +12,195 @@ class SetBluetooth extends StatefulWidget {
}

class _SetBluetoothState extends State<SetBluetooth> {
void _goHome() {
setState(() {
Navigator.pop(context);
// Navigator.pushNamed(context, "/intro");
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Bluetooth Configuration"),
Text("Selected Device: ${widget.deviceSelected}"),
],
return Theme(
data: Theme.of(context).copyWith(
textTheme: Theme.of(context)
.textTheme
.apply(bodyColor: Colors.white, displayColor: Colors.white)),
child: Scaffold(
backgroundColor: Color.fromRGBO(30, 30, 30, 1.0),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: Container(
decoration: BoxDecoration(
color: widget.deviceSelected == "iPhone"
? Colors.white
: Color.fromRGBO(143, 175, 106,
1.0), // Set background color for the container
borderRadius:
BorderRadius.circular(10.0), // Set border radius
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
"Scan the QR Code to pair your Mobile",
style: TextStyle(
fontSize: 28,
color: widget.deviceSelected == "iPhone"
? Colors.black
: Colors.white,
),
),
),
),
),

// Content here

Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text("QR Code Here"),
Column(
children: [
Padding(
padding: const EdgeInsets.all(16.0),
child: Text(
" Let's pair your phone using Bluetooth. \n 1. Open the HarmonySync App on your phone \n 2. Scan the QR Code to pair this device. "),
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
_textFieldOTP(first: true, last: false),
_textFieldOTP(first: false, last: false),
_textFieldOTP(first: false, last: false),
_textFieldOTP(first: false, last: true),
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: FilledButton.icon(
iconAlignment: IconAlignment.end,
label: Text("Pair"),
style: FilledButton.styleFrom(
padding: EdgeInsets.all(16.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
5), // Button's shape
),
backgroundColor:
Color.fromRGBO(30, 51, 79, 1.0),
),
onPressed: () {},
icon: const Icon(
Icons.keyboard_double_arrow_right,
color: Colors.white,
),
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: FilledButton.icon(
iconAlignment: IconAlignment.end,
label: Text("Cancel"),
style: FilledButton.styleFrom(
padding: EdgeInsets.all(16.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
5), // Button's shape
),
backgroundColor:
Color.fromRGBO(192, 76, 76, 1.0)),
onPressed: () {
_goHome();
},
icon: const Icon(
Icons.cancel,
color: Colors.white,
),
),
),
],
)
],
),
],
),

// Text(
// "Selected Device: ${widget.deviceSelected}",
// ),
Padding(
padding: const EdgeInsets.all(24.0),
child: IconButton.filled(
onPressed: () {
_goHome();
},
icon: Icon(Icons.arrow_back_outlined),
iconSize: 24,
style: IconButton.styleFrom(
backgroundColor: widget.deviceSelected == "iPhone"
? Colors.white
: Color.fromRGBO(143, 175, 106, 1.0)),
color: widget.deviceSelected == "iPhone"
? Colors.black
: Colors.white,
),
)
],
),
),
));
}

Widget _textFieldOTP({bool? first, last}) {
return Padding(
padding: const EdgeInsets.all(4.0),
child: Container(
height: 50,
width: 40,
child: AspectRatio(
aspectRatio: 1.0,
child: TextField(
autofocus: true,
onChanged: (value) {
if (value.length == 1 && last == false) {
FocusScope.of(context).nextFocus();
}
if (value.length == 0 && first == false) {
FocusScope.of(context).previousFocus();
}
},
showCursor: false,
readOnly: false,
textAlign: TextAlign.center,
style: TextStyle(fontSize: 16),
keyboardType: TextInputType.number,
maxLength: 1,
decoration: InputDecoration(
counter: Offstage(),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 1,
color: widget.deviceSelected == "iPhone"
? Colors.white
: Colors.green),
borderRadius: BorderRadius.circular(5)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 1,
color: widget.deviceSelected == "iPhone"
? Colors.white
: Colors.green),
borderRadius: BorderRadius.circular(5)),
),
),
),
),
);
Expand Down
5 changes: 2 additions & 3 deletions harmonylink/lib/pages/intro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ class _IntroScreenState extends State<IntroScreen> {

void _setBluetooth(String deviceSelected) {
setState(() {
Navigator.pop(context);
Navigator.pushNamed(context, "/SetBluetooth",
arguments: {'deviceSelected': deviceSelected});
});
Expand Down Expand Up @@ -71,7 +70,7 @@ class _IntroScreenState extends State<IntroScreen> {
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(5), // button's shape
BorderRadius.circular(5), // Button's shape
),
elevation: 5,
backgroundColor: Colors.white,
Expand Down Expand Up @@ -100,7 +99,7 @@ class _IntroScreenState extends State<IntroScreen> {
BorderRadius.circular(5), // button's shape
),
elevation: 5,
backgroundColor: Colors.green[700],
backgroundColor: Color.fromRGBO(143, 175, 106, 1.0),
padding: EdgeInsets.all(16.0)),
),
),
Expand Down

0 comments on commit eaa03c0

Please sign in to comment.