Skip to content

Commit

Permalink
better you box
Browse files Browse the repository at this point in the history
  • Loading branch information
bipinkrish committed Sep 19, 2023
1 parent 5c48349 commit 6faa19a
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 64 deletions.
17 changes: 16 additions & 1 deletion lib/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:shared_preferences/shared_preferences.dart';

////////////////////////////////////////////////////////////// Constants
const String version = "v1.2.5";
const String version = "v1.2.7";
const String copyright = "© 2023 Bipin";
const Color mainColor = Colors.deepOrange;

Expand Down Expand Up @@ -224,6 +224,21 @@ Row getrow(String name, String value) {
);
}

// col of key value
Column getcol(String name, String value) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("$name "),
Text(
value.length <= 20 ? value : '${value.substring(0, 20)}...',
style: const TextStyle(color: mainColor),
)
],
);
}


/////////////////////////////////////////////////// Shared Prefrences
void save(String key, String value) async {
Expand Down
98 changes: 36 additions & 62 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -353,69 +353,43 @@ class _HomePageState extends State<HomePage> {
borderRadius: BorderRadius.circular(10),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Flexible(
flex: 1,
child: Center(
child: Icon(thisSysIcon),
),
),
Flexible(
flex: 9,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
getrow("Device", localName),
getrow("IP", localIP),
],
),
const SizedBox(
height: 10,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
getrow("Port", port.toString()),
Row(
children: [
const Text("Interface "),
DropdownButton(
style: const TextStyle(color: mainColor),
value: localIP,
borderRadius: BorderRadius.circular(8),
items: [
for (DiscoveredNetwork network
in discoveredNetwork)
DropdownMenuItem(
value: network.addr,
child: Text(
network.name,
style: TextStyle(
color: localIP == network.addr
? mainColor
: Theme.of(context).brightness ==
Brightness.light
? Colors.black
: Colors.white,
),
),
)
],
onChanged: (value) {
localIP = value!;
startDeviceDiscovery(tapped: true);
refresh();
},
Icon(thisSysIcon),
getcol("Device", localName),
getcol("IP", localIP),
// getcol("Port", port.toString()),
Column(
children: [
const Text("Interface "),
DropdownButton(
style: const TextStyle(color: mainColor),
value: localIP,
borderRadius: BorderRadius.circular(8),
items: [
for (DiscoveredNetwork network in discoveredNetwork)
DropdownMenuItem(
value: network.addr,
child: Text(
network.name,
style: TextStyle(
color: localIP == network.addr
? mainColor
: Theme.of(context).brightness ==
Brightness.light
? Colors.black
: Colors.white,
),
],
),
],
)
],
),
),
)
],
onChanged: (value) {
localIP = value!;
startDeviceDiscovery(tapped: true);
refresh();
},
),
],
),
],
),
Expand Down Expand Up @@ -447,7 +421,7 @@ class _HomePageState extends State<HomePage> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text("$device is requesting to chat with you"),
getrow("Chat request from", device),
const SizedBox(
height: 20,
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: localconnect
description: A new Flutter project.
publish_to: 'none'
version: 1.2.5+2
version: 1.2.7+2

environment:
sdk: '>=3.1.0 <4.0.0'
Expand Down

0 comments on commit 6faa19a

Please sign in to comment.