Skip to content

Instantly share code, notes, and snippets.

@idrisAkbarA
Created May 20, 2020 05:20
Show Gist options
  • Save idrisAkbarA/1dc4ab9141b106c28611f65403cdd1c0 to your computer and use it in GitHub Desktop.
Save idrisAkbarA/1dc4ab9141b106c28611f65403cdd1c0 to your computer and use it in GitHub Desktop.
Expansion Panel with ScrollView
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Container(
color: Color.fromARGB(255, 66, 165, 245),
alignment: AlignmentDirectional(0.0, 0.0),
child: Container(
color: Colors.green,
constraints: BoxConstraints.expand(),
child: Card(child:Column(
children:<Widget>[
Card(
color:Colors.yellow,
child:Column(
children:<Widget>[
ExpansionTile(
title:Text("Title"),
children:<Widget>[
Column(children:<Widget>[
Container(
color: Colors.green,
child: SingleChildScrollView(
child: Column(
children: [
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
Text("Idris"),
],
),
),
constraints: BoxConstraints(
maxHeight: 300.0,
maxWidth: 200.0,
minWidth: 150.0,
minHeight: 150.0
),)
])
]
)
]
),
),
]
)),
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: Icon(Icons.add),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment