Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to new Material widgets. #1026

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class BluetoothOffScreen extends StatelessWidget {
'Bluetooth Adapter is ${state != null ? state.toString().substring(15) : 'not available'}.',
style: Theme.of(context)
.primaryTextTheme
.subhead
.subtitle1
?.copyWith(color: Colors.white),
),
],
Expand Down Expand Up @@ -92,7 +92,7 @@ class FindDevicesScreen extends StatelessWidget {
builder: (c, snapshot) {
if (snapshot.data ==
BluetoothDeviceState.connected) {
return RaisedButton(
return ElevatedButton(
child: Text('OPEN'),
onPressed: () => Navigator.of(context).push(
MaterialPageRoute(
Expand Down Expand Up @@ -227,7 +227,7 @@ class DeviceScreen extends StatelessWidget {
text = snapshot.data.toString().substring(21).toUpperCase();
break;
}
return FlatButton(
return TextButton(
onPressed: onPressed,
child: Text(
text,
Expand Down
18 changes: 10 additions & 8 deletions example/lib/widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ class ScanResultTile extends StatelessWidget {
return ExpansionTile(
title: _buildTitle(context),
leading: Text(result.rssi.toString()),
trailing: RaisedButton(
trailing: ElevatedButton(
child: Text('CONNECT'),
color: Colors.black,
textColor: Colors.white,
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.black),
foregroundColor: MaterialStateProperty.all<Color>(Colors.white)
),
onPressed: (result.advertisementData.connectable) ? onTap : null,
),
children: <Widget>[
Expand Down Expand Up @@ -135,7 +137,7 @@ class ServiceTile extends StatelessWidget {
children: <Widget>[
Text('Service'),
Text('0x${service.uuid.toString().toUpperCase().substring(4, 8)}',
style: Theme.of(context).textTheme.body1?.copyWith(
style: Theme.of(context).textTheme.bodyText1?.copyWith(
color: Theme.of(context).textTheme.caption?.color))
],
),
Expand Down Expand Up @@ -183,7 +185,7 @@ class CharacteristicTile extends StatelessWidget {
Text('Characteristic'),
Text(
'0x${characteristic.uuid.toString().toUpperCase().substring(4, 8)}',
style: Theme.of(context).textTheme.body1?.copyWith(
style: Theme.of(context).textTheme.bodyText1?.copyWith(
color: Theme.of(context).textTheme.caption?.color))
],
),
Expand Down Expand Up @@ -245,7 +247,7 @@ class DescriptorTile extends StatelessWidget {
Text('0x${descriptor.uuid.toString().toUpperCase().substring(4, 8)}',
style: Theme.of(context)
.textTheme
.body1
.bodyText1
?.copyWith(color: Theme.of(context).textTheme.caption?.color))
],
),
Expand Down Expand Up @@ -289,11 +291,11 @@ class AdapterStateTile extends StatelessWidget {
child: ListTile(
title: Text(
'Bluetooth adapter is ${state.toString().substring(15)}',
style: Theme.of(context).primaryTextTheme.subhead,
style: Theme.of(context).primaryTextTheme.subtitle1,
),
trailing: Icon(
Icons.error,
color: Theme.of(context).primaryTextTheme.subhead?.color,
color: Theme.of(context).primaryTextTheme.subtitle1?.color,
),
),
);
Expand Down