Skip to content

Instantly share code, notes, and snippets.

@KanybekMomukeyev
Created August 20, 2022 01:57
Show Gist options
  • Save KanybekMomukeyev/7e494f10f1efb07eaeb9cfeae6f554bc to your computer and use it in GitHub Desktop.
Save KanybekMomukeyev/7e494f10f1efb07eaeb9cfeae6f554bc to your computer and use it in GitHub Desktop.
not pressing button
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme:
ThemeData(primarySwatch: Colors.blue, brightness: Brightness.light),
home: const BasicDemo(),
);
}
}
class BasicDemo extends StatelessWidget {
const BasicDemo({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverAppBar(
pinned: true,
expandedHeight: 300.0,
flexibleSpace: const FlexibleSpaceBar(
centerTitle: true,
titlePadding: EdgeInsets.only(bottom: 25),
title: Text('Title here'),
),
bottom: PreferredSize(
preferredSize: const Size.fromHeight(0.0),
child: Transform.translate(
offset: const Offset(0, 50),
child: TextButton(
child: const Text("Click Here"),
onPressed: () {
debugPrint("Click Here");
},
),
),
),
),
const SliverPadding(
padding: EdgeInsets.only(top: 50),
),
SliverList(
delegate: SliverChildListDelegate(
List.generate(
20,
(index) {
return Padding(
padding: const EdgeInsets.all(5.0),
child: ListTile(
title: Text(
'$index',
style: Theme.of(context)
.textTheme
.headline5
?.copyWith(color: Colors.black),
),
onTap: () {},
),
);
},
),
),
),
],
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment