-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate WifiPage in ConnectionsPage (#165)
* Consolidate WifiPage in ConnectionsPage * Hierachy fix and light theme fix * Styling changes * write Wi-Fi correctly * Limit the width of the tabbar * Move wifi to it's own file
- Loading branch information
1 parent
f2b0cc5
commit 2f75b35
Showing
11 changed files
with
118 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:nm/nm.dart'; | ||
import 'package:provider/provider.dart'; | ||
import 'package:settings/view/pages/connections/wifi_content.dart'; | ||
import 'package:yaru_icons/widgets/yaru_icons.dart'; | ||
|
||
import 'models/wifi_model.dart'; | ||
|
||
class ConnectionsPage extends StatefulWidget { | ||
static Widget create(BuildContext context) { | ||
final service = Provider.of<NetworkManagerClient>(context, listen: false); | ||
return ChangeNotifierProvider<WifiModel>( | ||
create: (_) => WifiModel(service), | ||
child: const ConnectionsPage(), | ||
); | ||
} | ||
|
||
const ConnectionsPage({Key? key}) : super(key: key); | ||
|
||
@override | ||
State<ConnectionsPage> createState() => _ConnectionsPageState(); | ||
} | ||
|
||
class _ConnectionsPageState extends State<ConnectionsPage> | ||
with TickerProviderStateMixin { | ||
late TabController tabController; | ||
|
||
@override | ||
void initState() { | ||
tabController = TabController(length: 3, vsync: this); | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final wifiModel = context.watch<WifiModel>(); | ||
return Column( | ||
children: [ | ||
Container( | ||
width: 516, | ||
height: 60, | ||
decoration: BoxDecoration(borderRadius: BorderRadius.circular(4)), | ||
child: TabBar( | ||
controller: tabController, | ||
indicator: BoxDecoration( | ||
borderRadius: BorderRadius.circular(4), | ||
color: | ||
Theme.of(context).colorScheme.onSurface.withOpacity(0.1)), | ||
tabs: const [ | ||
Tab( | ||
icon: Icon(YaruIcons.network_wireless), | ||
child: Text("Wi-Fi")), | ||
Tab( | ||
icon: Icon(YaruIcons.network_wired), | ||
child: Text("Ethernet")), | ||
Tab( | ||
icon: Icon(YaruIcons.call_incoming), | ||
child: Text("Cellular")), | ||
]), | ||
), | ||
Padding( | ||
padding: const EdgeInsets.only(top: 30), | ||
child: SizedBox( | ||
height: 1000, | ||
child: TabBarView( | ||
controller: tabController, | ||
children: [ | ||
wifiModel.isWifiDeviceAvailable | ||
? const WifiDevicesContent() | ||
: const WifiAdaptorNotFound(), | ||
Column( | ||
children: const [Text('Ethernet')], | ||
), | ||
Column( | ||
children: const [Text('Cellular')], | ||
) | ||
], | ||
), | ||
), | ||
), | ||
], | ||
); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters