Skip to content

Instantly share code, notes, and snippets.

@slightfoot
Created June 30, 2018 14:15

Revisions

  1. slightfoot created this gist Jun 30, 2018.
    91 changes: 91 additions & 0 deletions ios_android.dart
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,91 @@
    import 'package:flutter/cupertino.dart';
    import 'package:flutter/foundation.dart';
    import 'package:flutter/material.dart';


    void main() {
    //runApp(IOSApp());
    //runApp(AndroidApp());
    runApp(defaultTargetPlatform == TargetPlatform.iOS ? IOSApp() : AndroidApp());
    }

    class IOSApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
    return MaterialApp(
    theme: ThemeData(primaryColor: Colors.grey[100]),
    home: Material(
    child: CupertinoPageScaffold(
    backgroundColor: CupertinoColors.lightBackgroundGray,
    navigationBar: CupertinoNavigationBar(middle: Text('Example')),
    child: ListView.builder(itemBuilder: (BuildContext context, int index) {
    return GestureDetector(
    onTap: () => {},
    child: Container(
    margin: const EdgeInsets.symmetric(vertical: 8.0),
    padding: const EdgeInsets.symmetric(horizontal: 10.0),
    height: 50.0,
    decoration: const BoxDecoration(
    color: CupertinoColors.white,
    border: Border(
    bottom: BorderSide(color: Colors.black26, width: 0.0)
    ),
    ),
    child: Row(
    children: <Widget>[
    Expanded(
    child: Text('Item $index',
    style: const TextStyle(fontSize: 16.0, color: Colors.black),
    ),
    ),
    Icon(CupertinoIcons.right_chevron,
    color: CupertinoColors.inactiveGray,
    ),
    ],
    ),
    ),
    );
    }),
    ),
    ),
    );
    }
    }

    class AndroidApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
    return MaterialApp(
    theme: ThemeData(primaryColor: Colors.grey[100]),
    home: Scaffold(
    backgroundColor: Colors.grey[200],
    appBar: AppBar(title: Text('Example')),
    body: ListView.builder(itemBuilder: (BuildContext context, int index) {
    return GestureDetector(
    onTap: () => {},
    child: Card(
    margin: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
    color: CupertinoColors.white,
    child: Container(
    padding: const EdgeInsets.symmetric(horizontal: 16.0),
    height: 56.0,
    child: Row(
    children: <Widget>[
    new Expanded(
    child: new Text('Item $index',
    style: new TextStyle(fontSize: 16.0, color: Colors.black),
    ),
    ),
    new Icon(Icons.chevron_right,
    color: Colors.grey,
    ),
    ],
    ),
    ),
    ),
    );
    }),
    ),
    );
    }
    }