Skip to content

Instantly share code, notes, and snippets.

@wackazong
Created March 21, 2022 09:05
Show Gist options
  • Save wackazong/38c0825f27c1b3395dd22794a2567e64 to your computer and use it in GitHub Desktop.
Save wackazong/38c0825f27c1b3395dd22794a2567e64 to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.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(
home: Scaffold(
body: CustomScrollView(
slivers: [
const CupertinoSliverNavigationBar(
padding: EdgeInsetsDirectional.only(end: 15),
largeTitle: Text('Search'),
),
SliverToBoxAdapter(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SizedBox(
width: 1600,
child: ListView.builder(
itemCount: 100,
shrinkWrap: true,
itemBuilder: (BuildContext context, int index) {
if (index == 0) {
return Container(
width: 1600,
padding: const EdgeInsets.all(5),
color: Colors.redAccent.shade100,
child: const Text('foo'),
);
} else {
return Container(
width: 1600,
padding: const EdgeInsets.all(5),
color: Colors.blueAccent.shade100,
child: const Text('bar'),
);
}
})),
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment