Skip to content

Instantly share code, notes, and snippets.

@albertdugba
Forked from iamEtornam/customAppBar.dart
Created January 14, 2020 16:41
Show Gist options
  • Save albertdugba/b322f28b63b0e49e8c5714965b511135 to your computer and use it in GitHub Desktop.
Save albertdugba/b322f28b63b0e49e8c5714965b511135 to your computer and use it in GitHub Desktop.
Scaffold(
appBar: AppBar(
title: AutoSizeText('Doctors List'),
bottom: PreferredSize(child: Row(children: <Widget>[
customButton((){},Icons.filter,'Filter'),
customButton((){},Icons.filter,'Filter'),
customButton((){},Icons.filter,'Filter'),
],), preferredSize: Size.fromHeight(70)),
)
);
customButton(VoidCallback callback, IconData icon, String desc){
return InkWell(
onTap: callback,
child: Material(
elevation:0,
borderRadius: BorderRadius.circular(10),
color: Colors.white.withOpacity(.5),
child: Padding(
padding: const EdgeInsets.all(15.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(icon,color: Colors.white,),
SizedBox(width:10),
Text(desc,style: TextStyle(color: Colors.white),
],),
),
),
),
);
}
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ConnectAccountPage extends StatefulWidget {
@override
_ConnectAccountPageState createState() => _ConnectAccountPageState();
}
class _ConnectAccountPageState extends State<ConnectAccountPage> {
int sharedValue = 0;
final Map<int, Widget> logoWidgets = const <int, Widget>{
0: Text('Accepted'),
1: Text('Pending'),
};
List<Widget> _children = [
AcceptedListPage(),
PendingListPage(),
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: 50,
padding: const EdgeInsets.all(8),
child: CupertinoSegmentedControl<int>(
selectedColor: Colors.red,
borderColor: Colors.red,
children: logoWidgets,
onValueChanged: (int val) {
setState(() {
sharedValue = val;
});
},
groupValue: sharedValue,
),
),
Expanded(
child: _children[sharedValue],
),
],
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment